From cb0f31905318b249a1e09088d12073061b6d59cc Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Mon, 20 Jan 2020 20:47:08 +0800 Subject: [PATCH 01/12] change folder name --- PKHUD.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PKHUD.xcodeproj/project.pbxproj b/PKHUD.xcodeproj/project.pbxproj index 48d2a14..5833176 100644 --- a/PKHUD.xcodeproj/project.pbxproj +++ b/PKHUD.xcodeproj/project.pbxproj @@ -225,7 +225,7 @@ F996324819514FEF001F73CA /* PKHUD.swift */, F996324619514FEF001F73CA /* PKHUDAssets.swift */, F935B15B1B2B8C03003C3734 /* Content Views */, - F9DB0B91197DB78B00385ACE /* Internal */, + F9DB0B91197DB78B00385ACE /* Layout */, F996325419514FF3001F73CA /* Images.xcassets */, F996322019514FD8001F73CA /* Supporting Files */, ); @@ -240,14 +240,14 @@ name = "Supporting Files"; sourceTree = ""; }; - F9DB0B91197DB78B00385ACE /* Internal */ = { + F9DB0B91197DB78B00385ACE /* Layout */ = { isa = PBXGroup; children = ( F996324919514FEF001F73CA /* FrameView.swift */, F996324B19514FEF001F73CA /* Window.swift */, F996324C19514FEF001F73CA /* WindowRootViewController.swift */, ); - name = Internal; + name = Layout; sourceTree = ""; }; /* End PBXGroup section */ From ffb087c2207ac20c1a9d23172546781490894de5 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 17:13:54 +0800 Subject: [PATCH 02/12] add travis config file --- PKHUD.travis.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 PKHUD.travis.yaml diff --git a/PKHUD.travis.yaml b/PKHUD.travis.yaml new file mode 100644 index 0000000..952e9b0 --- /dev/null +++ b/PKHUD.travis.yaml @@ -0,0 +1,4 @@ +language: swift +xcode_project: PKHUD.xcodeproj # path to your xcodeproj folder +xcode_destination: platform=iOS Simulator,OS=10.1,name=iPad Pro (9.7-inch) +osx_image: xcode11 From 16bed4c93b6e1b59b754caec8329fd836843b68f Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 17:23:42 +0800 Subject: [PATCH 03/12] change travis config file --- PKHUD.travis.yaml => PKHUD.travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename PKHUD.travis.yaml => PKHUD.travis.yml (100%) diff --git a/PKHUD.travis.yaml b/PKHUD.travis.yml similarity index 100% rename from PKHUD.travis.yaml rename to PKHUD.travis.yml From 9af9d59bc9b3ac4d4ef74ff5fda8929b6e601b45 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 18:26:59 +0800 Subject: [PATCH 04/12] change travis config file2 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45c6f44..923c652 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ -language: objective-c -osx_image: xcode9 +language: swift +osx_image: xcode11 env: global: - LC_CTYPE=en_US.UTF-8 From 4df150ffb4711981c5d1c6cbcc5f14af29f5d7cf Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 20:24:53 +0800 Subject: [PATCH 05/12] fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 923c652..5e003d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" before_install: - - gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet + - gem install cocoapods --pre --no-document --no-ri --no-document --quiet script: - set -o pipefail - xcodebuild -version From 7116d8cca611adf0f8d9206af5bb46ad29ec9cda Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 20:27:50 +0800 Subject: [PATCH 06/12] fix travis2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5e003d9..04bda8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ env: - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" before_install: - - gem install cocoapods --pre --no-document --no-ri --no-document --quiet + - gem install cocoapods --pre --no-document --quiet script: - set -o pipefail - xcodebuild -version From 6e23581d2c56e4406b03e657281464c7ad5e3755 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 20:37:07 +0800 Subject: [PATCH 07/12] fix travis3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 04bda8b..4fb693d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ env: - LC_CTYPE=en_US.UTF-8 - LANG=en_US.UTF-8 - PROJECT=PKHUD.xcodeproj - - IOS_SDK=iphonesimulator11.0 + - IOS_SDK=iphonesimulator13.0 - IOS_FRAMEWORK_SCHEME="PKHUD" - EXAMPLE_SCHEME="PKHUD Demo" - UITEST_SCHEME="PKHUDDemoUITests" From b7aaa47fa93d31b23813e3b6bc1ba3a07ea13144 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 20:44:46 +0800 Subject: [PATCH 08/12] fix travis4 --- .travis.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4fb693d..61f9415 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,17 @@ env: - EXAMPLE_SCHEME="PKHUD Demo" - UITEST_SCHEME="PKHUDDemoUITests" matrix: - - DESTINATION="OS=11.0,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - - DESTINATION="OS=11.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - - DESTINATION="OS=10.3.1,name=iPhone 7" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=13.0,name=iPhone 11 Pro" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=10.3.1,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=9.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=8.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" + + # - DESTINATION="OS=11.0,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + # - DESTINATION="OS=11.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + # - DESTINATION="OS=10.3.1,name=iPhone 7" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + # - DESTINATION="OS=9.0,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + # - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" before_install: - gem install cocoapods --pre --no-document --quiet script: From 3ac45088c10784b8e0fbdc34c8caaeb12572f162 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 20:48:33 +0800 Subject: [PATCH 09/12] fix travis5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 61f9415..7367a14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - EXAMPLE_SCHEME="PKHUD Demo" - UITEST_SCHEME="PKHUDDemoUITests" matrix: - - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - DESTINATION="OS=13.0,name=iPhone 11 Pro" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - DESTINATION="OS=10.3.1,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=9.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" From 95fd323abf45d8747b69eb69fc27e6c747e527d9 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 21:11:01 +0800 Subject: [PATCH 10/12] fix travis 6 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7367a14..acd2702 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,9 @@ env: matrix: - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - DESTINATION="OS=13.0,name=iPhone 11 Pro" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - - DESTINATION="OS=10.3.1,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=9.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=8.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=13.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + - DESTINATION="OS=13.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" # - DESTINATION="OS=11.0,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" # - DESTINATION="OS=11.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" From 70912028869265223a59a6d238032b438a2acaca Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 21:17:09 +0800 Subject: [PATCH 11/12] fix travis 7 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index acd2702..b46c5bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,11 @@ env: - EXAMPLE_SCHEME="PKHUD Demo" - UITEST_SCHEME="PKHUDDemoUITests" matrix: - - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - - DESTINATION="OS=13.0,name=iPhone 11 Pro" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" - - DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" + # - DESTINATION="OS=13.0,name=iPhone 11 Pro Max" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + # - DESTINATION="OS=13.0,name=iPhone 11 Pro" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" + # - DESTINATION="OS=13.0,name=iPhone 11" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - DESTINATION="OS=13.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" - - DESTINATION="OS=13.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" + # - DESTINATION="OS=13.1,name=iPhone 8 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="YES" POD_LINT="NO" # - DESTINATION="OS=11.0,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" # - DESTINATION="OS=11.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES" From 9de3db27dfd10b8528b253e4edb7b67dd5de0bf5 Mon Sep 17 00:00:00 2001 From: Ian <15120073241@126.com> Date: Tue, 21 Jan 2020 21:37:22 +0800 Subject: [PATCH 12/12] fix swiftLint warning --- Demo/DemoViewController.swift | 9 +++---- .../AppIcon.appiconset/Contents.json | 25 +++++++++++++++++++ PKHUD.xcodeproj/project.pbxproj | 8 +++--- PKHUD/HUD.swift | 4 +-- PKHUD/PKHUD.swift | 4 +-- PKHUD/Window.swift | 16 ++++++------ 6 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Demo/DemoViewController.swift b/Demo/DemoViewController.swift index 2a60cb7..0022fc8 100644 --- a/Demo/DemoViewController.swift +++ b/Demo/DemoViewController.swift @@ -10,20 +10,19 @@ import UIKit import PKHUD class DemoViewController: UIViewController { - - let hiddenTextField = UITextField(frame: CGRect.zero) + let hiddenTextField = UITextField(frame: CGRect.zero) override func viewDidLoad() { super.viewDidLoad() view.addSubview(hiddenTextField) HUD.registerForKeyboardNotifications() - + HUD.dimsBackground = false HUD.allowsInteraction = false } - + @IBAction func showHideKeyboard(_ sender: Any) { if hiddenTextField.isEditing { view.endEditing(true) @@ -64,7 +63,7 @@ class DemoViewController: UIViewController { print("License Obtained.") } } - + deinit { HUD.deregisterFromKeyboardNotifications() } diff --git a/Demo/Images.xcassets/AppIcon.appiconset/Contents.json b/Demo/Images.xcassets/AppIcon.appiconset/Contents.json index eeea76c..d8db8d6 100644 --- a/Demo/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Demo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -64,6 +84,11 @@ "idiom" : "ipad", "size" : "83.5x83.5", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/PKHUD.xcodeproj/project.pbxproj b/PKHUD.xcodeproj/project.pbxproj index 5833176..8bdfdaa 100644 --- a/PKHUD.xcodeproj/project.pbxproj +++ b/PKHUD.xcodeproj/project.pbxproj @@ -334,7 +334,7 @@ TargetAttributes = { 12CE19F01E25784C0062D873 = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1120; ProvisioningStyle = Automatic; TestTargetID = F99631FB19514FAC001F73CA; }; @@ -410,7 +410,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n\n"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\n echo \"abc\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\n exit 1\nfi\n\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -495,7 +495,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "PKHUD Demo"; }; name = Debug; @@ -514,7 +514,7 @@ PRODUCT_BUNDLE_IDENTIFIER = NSExceptional.PKHUDDemoUITests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_TARGET_NAME = "PKHUD Demo"; }; name = Release; diff --git a/PKHUD/HUD.swift b/PKHUD/HUD.swift index 50a42eb..26bb9fa 100644 --- a/PKHUD/HUD.swift +++ b/PKHUD/HUD.swift @@ -80,12 +80,12 @@ public final class HUD { HUD.show(content, onView: view) HUD.hide(afterDelay: delay, completion: completion) } - + // MARK: Keyboard Methods public static func registerForKeyboardNotifications() { PKHUD.sharedHUD.registerForKeyboardNotifications() } - + public static func deregisterFromKeyboardNotifications() { PKHUD.sharedHUD.deregisterFromKeyboardNotifications() } diff --git a/PKHUD/PKHUD.swift b/PKHUD/PKHUD.swift index acfc901..6f7b4c6 100644 --- a/PKHUD/PKHUD.swift +++ b/PKHUD/PKHUD.swift @@ -198,11 +198,11 @@ open class PKHUD: NSObject { animatingContentView.stopAnimation?() } } - + internal func registerForKeyboardNotifications() { container.registerForKeyboardNotifications() } - + internal func deregisterFromKeyboardNotifications() { container.deregisterFromKeyboardNotifications() } diff --git a/PKHUD/Window.swift b/PKHUD/Window.swift index a880b84..fdc8934 100644 --- a/PKHUD/Window.swift +++ b/PKHUD/Window.swift @@ -14,7 +14,7 @@ internal class ContainerView: UIView { private var keyboardIsVisible = false private var keyboardHeight: CGFloat = 0.0 - + internal let frameView: FrameView internal init(frameView: FrameView = FrameView()) { self.frameView = frameView @@ -42,8 +42,6 @@ internal class ContainerView: UIView { frameView.center = calculateHudCenter() backgroundView.frame = bounds } - - internal func showFrameView() { layer.removeAllAnimations() @@ -106,18 +104,18 @@ internal class ContainerView: UIView { backgroundView.alpha = 0.0 } } - + // MARK: Notifications internal func registerForKeyboardNotifications() { NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardDidShowNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillBeHidden(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil) } - + internal func deregisterFromKeyboardNotifications() { NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) } - + // MARK: Triggered Functions @objc private func keyboardWillShow(notification: NSNotification) { keyboardIsVisible = true @@ -136,7 +134,7 @@ internal class ContainerView: UIView { } } } - + @objc private func keyboardWillBeHidden(notification: NSNotification) { keyboardIsVisible = false if !self.isHidden { @@ -151,7 +149,7 @@ internal class ContainerView: UIView { } } } - + // MARK: - Helpers private func animateHUDWith(duration: Double, curve: UIView.AnimationCurve, toLocation location: CGPoint) { UIView.beginAnimations(nil, context: nil) @@ -160,7 +158,7 @@ internal class ContainerView: UIView { frameView.center = location UIView.commitAnimations() } - + private func calculateHudCenter() -> CGPoint { if !keyboardIsVisible { return center