Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change folder name #271

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
language: objective-c
osx_image: xcode9
language: swift
osx_image: xcode11
env:
global:
- 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"
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=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"
# - 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-rdoc --no-ri --no-document --quiet
- gem install cocoapods --pre --no-document --quiet
script:
- set -o pipefail
- xcodebuild -version
Expand Down
9 changes: 4 additions & 5 deletions Demo/DemoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -64,7 +63,7 @@ class DemoViewController: UIViewController {
print("License Obtained.")
}
}

deinit {
HUD.deregisterFromKeyboardNotifications()
}
Expand Down
25 changes: 25 additions & 0 deletions Demo/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -64,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
4 changes: 4 additions & 0 deletions PKHUD.travis.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions PKHUD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
F996324819514FEF001F73CA /* PKHUD.swift */,
F996324619514FEF001F73CA /* PKHUDAssets.swift */,
F935B15B1B2B8C03003C3734 /* Content Views */,
F9DB0B91197DB78B00385ACE /* Internal */,
F9DB0B91197DB78B00385ACE /* Layout */,
F996325419514FF3001F73CA /* Images.xcassets */,
F996322019514FD8001F73CA /* Supporting Files */,
);
Expand All @@ -240,14 +240,14 @@
name = "Supporting Files";
sourceTree = "<group>";
};
F9DB0B91197DB78B00385ACE /* Internal */ = {
F9DB0B91197DB78B00385ACE /* Layout */ = {
isa = PBXGroup;
children = (
F996324919514FEF001F73CA /* FrameView.swift */,
F996324B19514FEF001F73CA /* Window.swift */,
F996324C19514FEF001F73CA /* WindowRootViewController.swift */,
);
name = Internal;
name = Layout;
sourceTree = "<group>";
};
/* End PBXGroup section */
Expand Down Expand Up @@ -334,7 +334,7 @@
TargetAttributes = {
12CE19F01E25784C0062D873 = {
CreatedOnToolsVersion = 8.2.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1120;
ProvisioningStyle = Automatic;
TestTargetID = F99631FB19514FAC001F73CA;
};
Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions PKHUD/HUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions PKHUD/PKHUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ open class PKHUD: NSObject {
animatingContentView.stopAnimation?()
}
}

internal func registerForKeyboardNotifications() {
container.registerForKeyboardNotifications()
}

internal func deregisterFromKeyboardNotifications() {
container.deregisterFromKeyboardNotifications()
}
Expand Down
16 changes: 7 additions & 9 deletions PKHUD/Window.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -42,8 +42,6 @@ internal class ContainerView: UIView {
frameView.center = calculateHudCenter()
backgroundView.frame = bounds
}



internal func showFrameView() {
layer.removeAllAnimations()
Expand Down Expand Up @@ -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
Expand All @@ -136,7 +134,7 @@ internal class ContainerView: UIView {
}
}
}

@objc private func keyboardWillBeHidden(notification: NSNotification) {
keyboardIsVisible = false
if !self.isHidden {
Expand All @@ -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)
Expand All @@ -160,7 +158,7 @@ internal class ContainerView: UIView {
frameView.center = location
UIView.commitAnimations()
}

private func calculateHudCenter() -> CGPoint {
if !keyboardIsVisible {
return center
Expand Down