From c9400e49d9662a655b92a695e76b8d9688bfbd2e Mon Sep 17 00:00:00 2001 From: prongbang Date: Sat, 19 Feb 2022 21:43:20 +0700 Subject: [PATCH] Set public func and constructor --- README.md | 2 +- ScreenProtectorKit.podspec | 2 +- .../ScreenProtectorKit/ScreenProtectorKit.swift | 16 ++++++++-------- .../ScreenProtectorKitTests.swift | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f4c2814..be12921 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ In your `Package.swift` file, add `ScreenProtectorKit` dependency to correspondi ```swift let package = Package( dependencies: [ - .package(url: "https://github.com/prongbang/ScreenProtectorKit.git", from: "1.0.2"), + .package(url: "https://github.com/prongbang/ScreenProtectorKit.git", from: "1.0.3"), ], ) ``` diff --git a/ScreenProtectorKit.podspec b/ScreenProtectorKit.podspec index a52955c..c61b238 100644 --- a/ScreenProtectorKit.podspec +++ b/ScreenProtectorKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'ScreenProtectorKit' - s.version = '1.0.2' + s.version = '1.0.3' s.summary = 'Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for iOS.' s.homepage = 'https://github.com/prongbang/ScreenProtectorKit' s.license = 'MIT' diff --git a/Sources/ScreenProtectorKit/ScreenProtectorKit.swift b/Sources/ScreenProtectorKit/ScreenProtectorKit.swift index 62d0dda..a4b7722 100644 --- a/Sources/ScreenProtectorKit/ScreenProtectorKit.swift +++ b/Sources/ScreenProtectorKit/ScreenProtectorKit.swift @@ -22,7 +22,7 @@ public class ScreenProtectorKit { private var screenBlur: UIView? = nil private var screenPrevent = UITextField() - init(window: UIWindow?) { + public init(window: UIWindow?) { self.window = window } @@ -37,7 +37,7 @@ public class ScreenProtectorKit { // // return true // } - func configurePreventionScreenshot() { + public func configurePreventionScreenshot() { guard let w = window else { return } if (!w.subviews.contains(screenPrevent)) { @@ -54,7 +54,7 @@ public class ScreenProtectorKit { // override func applicationDidBecomeActive(_ application: UIApplication) { // screenProtectorKit.enabledPreventScreenshot() // } - func enabledPreventScreenshot() { + public func enabledPreventScreenshot() { screenPrevent.isSecureTextEntry = true } @@ -63,7 +63,7 @@ public class ScreenProtectorKit { // override func applicationWillResignActive(_ application: UIApplication) { // screenProtectorKit.disablePreventScreenshot() // } - func disablePreventScreenshot() { + public func disablePreventScreenshot() { screenPrevent.isSecureTextEntry = false } @@ -72,7 +72,7 @@ public class ScreenProtectorKit { // override func applicationWillResignActive(_ application: UIApplication) { // screenProtectorKit.enabledBlurScreen() // } - func enabledBlurScreen(style: UIBlurEffect.Style = UIBlurEffect.Style.light) { + public func enabledBlurScreen(style: UIBlurEffect.Style = UIBlurEffect.Style.light) { screenBlur = UIScreen.main.snapshotView(afterScreenUpdates: false) let blurEffect = UIBlurEffect(style: style) let blurBackground = UIVisualEffectView(effect: blurEffect) @@ -86,7 +86,7 @@ public class ScreenProtectorKit { // override func applicationDidBecomeActive(_ application: UIApplication) { // screenProtectorKit.disableBlurScreen() // } - func disableBlurScreen() { + public func disableBlurScreen() { screenBlur?.removeFromSuperview() screenBlur = nil } @@ -96,7 +96,7 @@ public class ScreenProtectorKit { // override func applicationWillResignActive(_ application: UIApplication) { // screenProtectorKit.enabledImageScreen(named: "LaunchImage") // } - func enabledImageScreen(named: String) { + public func enabledImageScreen(named: String) { screenImage = UIImageView(frame: UIScreen.main.bounds) screenImage?.image = UIImage(named: named) screenImage?.isUserInteractionEnabled = false @@ -110,7 +110,7 @@ public class ScreenProtectorKit { // override func applicationDidBecomeActive(_ application: UIApplication) { // screenProtectorKit.disableImageScreen() // } - func disableImageScreen() { + public func disableImageScreen() { screenImage?.removeFromSuperview() screenImage = nil } diff --git a/Tests/ScreenProtectorKitTests/ScreenProtectorKitTests.swift b/Tests/ScreenProtectorKitTests/ScreenProtectorKitTests.swift index d9280e8..d6f3a5d 100644 --- a/Tests/ScreenProtectorKitTests/ScreenProtectorKitTests.swift +++ b/Tests/ScreenProtectorKitTests/ScreenProtectorKitTests.swift @@ -6,6 +6,7 @@ final class ScreenProtectorKitTests: XCTestCase { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct // results. - XCTAssertEqual(ScreenProtectorKit().text, "Hello, World!") + let screenProtectorKit = ScreenProtectorKit(window: nil) + XCTAssertEqual(screenProtectorKit != nil, true) } }