From 898ab19551871a0dafefc701d74ea660ab57a17e Mon Sep 17 00:00:00 2001 From: Wesley de Groot Date: Tue, 23 Jul 2024 21:11:17 +0200 Subject: [PATCH] Fix SwiftLint --- .github/workflows/tests.yml | 2 +- .../preventScreenshot/preventScreenshot.swift | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1333bf5..fbb519a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ on: jobs: test_linux: - if: true + if: false runs-on: ubuntu-latest continue-on-error: true steps: diff --git a/Sources/preventScreenshot/preventScreenshot.swift b/Sources/preventScreenshot/preventScreenshot.swift index 320dbed..26255d5 100644 --- a/Sources/preventScreenshot/preventScreenshot.swift +++ b/Sources/preventScreenshot/preventScreenshot.swift @@ -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: PlatformRepresentable { +struct ScreenshotPreventWrapper: 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) @@ -77,12 +77,12 @@ public struct ScreenshotPreventWrapper: 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