Skip to content

Commit

Permalink
Fix SwiftLint
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWDG committed Jul 23, 2024
1 parent 6604f07 commit 898ab19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
test_linux:
if: true
if: false
runs-on: ubuntu-latest
continue-on-error: true
steps:
Expand Down
30 changes: 15 additions & 15 deletions Sources/preventScreenshot/preventScreenshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ import SwiftUI

#if !os(watchOS)
#if os(macOS)
public typealias PlatformView = NSView
public typealias PlatformTextField = NSSecureTextField
public typealias PlatformRepresentable = NSViewRepresentable
public typealias PlatformHostingController = NSHostingController
typealias PlatformView = NSView
typealias PlatformTextField = NSSecureTextField
typealias PlatformRepresentable = NSViewRepresentable
typealias PlatformHostingController = NSHostingController
#else
public typealias PlatformView = UIView
public typealias PlatformTextField = UITextField
public typealias PlatformRepresentable = UIViewRepresentable
public typealias PlatformHostingController = UIHostingController
typealias PlatformView = UIView
typealias PlatformTextField = UITextField
typealias PlatformRepresentable = UIViewRepresentable
typealias PlatformHostingController = UIHostingController
#endif

/// Screenshot Prevent Wrapper
public struct ScreenshotPreventWrapper<Content: View>: PlatformRepresentable {
struct ScreenshotPreventWrapper<Content: View>: PlatformRepresentable {
let content: () -> Content

public init(@ViewBuilder content: @escaping () -> Content) {
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content
}

public func makeNSView(context: Context) -> PlatformView {
func makeNSView(context: Context) -> PlatformView {
return self.makeUIView(context: context)
}

public func makeUIView(context: Context) -> PlatformView {
func makeUIView(context: Context) -> PlatformView {
let secureTextField = PlatformTextField()

#if !os(macOS)
Expand Down Expand Up @@ -77,12 +77,12 @@ public struct ScreenshotPreventWrapper<Content: View>: PlatformRepresentable {
return secureView
}

public func updateNSView(_ nsView: PlatformView, context: Context) { }
public func updateUIView(_ uiView: PlatformView, context: Context) { }
func updateNSView(_ nsView: PlatformView, context: Context) { }
func updateUIView(_ uiView: PlatformView, context: Context) { }
}


extension View {
/// Prevent Screenshot
@ViewBuilder public func preventScreenshot() -> some View {
ScreenshotPreventWrapper {
self
Expand Down

0 comments on commit 898ab19

Please sign in to comment.