Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 78b6200

Browse files
authored
Merge pull request #31 from nodes-ios/develop
Version 3.0.0
2 parents a34eaff + e4cd1fa commit 78b6200

File tree

9 files changed

+87
-116
lines changed

9 files changed

+87
-116
lines changed

KeyboardHelper.podspec

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "KeyboardHelper"
19-
s.version = "1.0.0"
19+
s.version = "3.0.0"
2020
s.summary = "Handle UIKeyboard with ease, delegation and strongly typed user info included!"
2121

2222
# This description is used to generate tags and improve search results.
@@ -29,8 +29,6 @@ Pod::Spec.new do |s|
2929
DESC
3030

3131
s.homepage = "https://github.com/nodes-ios/KeyboardHelper"
32-
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33-
3432

3533
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
3634
#
@@ -40,8 +38,6 @@ Pod::Spec.new do |s|
4038
#
4139

4240
s.license = "MIT"
43-
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
44-
4541

4642
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
4743
#
@@ -54,23 +50,15 @@ Pod::Spec.new do |s|
5450
#
5551

5652
s.author = { "Nodes Agency - iOS" => "[email protected]" }
57-
s.social_media_url = "http://twitter.com/nodes_ios"
5853

5954
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
6055
#
6156
# If this Pod runs only on iOS or OS X, then specify the platform and
6257
# the deployment target. You can optionally include the target after the platform.
6358
#
6459

65-
s.platform = :ios
66-
# s.platform = :ios, "5.0"
67-
68-
# When using multiple platforms
69-
s.ios.deployment_target = "8.0"
70-
# s.osx.deployment_target = "10.7"
71-
# s.watchos.deployment_target = "2.0"
72-
# s.tvos.deployment_target = "9.0"
73-
60+
s.platform = :ios, "8.0"
61+
s.swift_version = "5.0"
7462

7563
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
7664
#
@@ -80,7 +68,6 @@ Pod::Spec.new do |s|
8068

8169
s.source = { :git => "https://github.com/nodes-ios/KeyboardHelper.git", :tag => s.version }
8270

83-
8471
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
8572
#
8673
# CocoaPods is smart about how it includes source code. For source files
@@ -91,46 +78,6 @@ Pod::Spec.new do |s|
9178

9279
s.source_files = "KeyboardHelper/Classes"
9380
# s.exclude_files = "Classes/Exclude"
94-
9581
# s.public_header_files = "KeyboardHelper/Supporting Files/*.h"
9682

97-
98-
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
99-
#
100-
# A list of resources included with the Pod. These are copied into the
101-
# target bundle with a build phase script. Anything else will be cleaned.
102-
# You can preserve files from being cleaned, please don't preserve
103-
# non-essential files like tests, examples and documentation.
104-
#
105-
106-
# s.resource = "icon.png"
107-
# s.resources = "Resources/*.png"
108-
109-
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
110-
111-
112-
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
113-
#
114-
# Link your library with frameworks, or libraries. Libraries do not include
115-
# the lib prefix of their name.
116-
#
117-
118-
# s.framework = "SomeFramework"
119-
# s.frameworks = "SomeFramework", "AnotherFramework"
120-
121-
# s.library = "iconv"
122-
# s.libraries = "iconv", "xml2"
123-
124-
125-
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
126-
#
127-
# If your library depends on compiler flags you can set them in the xcconfig hash
128-
# where they will only apply to your library. If you depend on other Podspecs
129-
# you can include multiple dependencies to ensure it works.
130-
131-
# s.requires_arc = true
132-
133-
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
134-
# s.dependency "JSONKit", "~> 1.4"
135-
13683
end

KeyboardHelper.xcodeproj/project.pbxproj

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
82B7938F1C64996E00AB8A48 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3636
82B793911C64996E00AB8A48 /* KeyboardAppearanceInfoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardAppearanceInfoTests.swift; sourceTree = "<group>"; };
3737
82B793921C64996E00AB8A48 /* KeyboardHelperTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardHelperTests.swift; sourceTree = "<group>"; };
38+
B46CCB632289A25500F801CD /* KeyboardHelper.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = KeyboardHelper.podspec; sourceTree = "<group>"; };
3839
/* End PBXFileReference section */
3940

4041
/* Begin PBXFrameworksBuildPhase section */
@@ -59,6 +60,7 @@
5960
275BCA6D1C57C9F800FF3647 = {
6061
isa = PBXGroup;
6162
children = (
63+
B46CCB632289A25500F801CD /* KeyboardHelper.podspec */,
6264
275BCA791C57C9F800FF3647 /* KeyboardHelper */,
6365
275BCA851C57C9F800FF3647 /* KeyboardHelperTests */,
6466
275BCA781C57C9F800FF3647 /* Products */,
@@ -184,25 +186,26 @@
184186
isa = PBXProject;
185187
attributes = {
186188
LastSwiftUpdateCheck = 0720;
187-
LastUpgradeCheck = 0810;
189+
LastUpgradeCheck = 1020;
188190
ORGANIZATIONNAME = Nodes;
189191
TargetAttributes = {
190192
275BCA761C57C9F800FF3647 = {
191193
CreatedOnToolsVersion = 7.2;
192-
LastSwiftMigration = 0900;
194+
LastSwiftMigration = 1020;
193195
};
194196
275BCA801C57C9F800FF3647 = {
195197
CreatedOnToolsVersion = 7.2;
196-
LastSwiftMigration = 0900;
198+
LastSwiftMigration = 1020;
197199
};
198200
};
199201
};
200202
buildConfigurationList = 275BCA711C57C9F800FF3647 /* Build configuration list for PBXProject "KeyboardHelper" */;
201203
compatibilityVersion = "Xcode 3.2";
202-
developmentRegion = English;
204+
developmentRegion = en;
203205
hasScannedForEncodings = 0;
204206
knownRegions = (
205207
en,
208+
Base,
206209
);
207210
mainGroup = 275BCA6D1C57C9F800FF3647;
208211
productRefGroup = 275BCA781C57C9F800FF3647 /* Products */;
@@ -266,18 +269,27 @@
266269
isa = XCBuildConfiguration;
267270
buildSettings = {
268271
ALWAYS_SEARCH_USER_PATHS = NO;
272+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
269273
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
270274
CLANG_CXX_LIBRARY = "libc++";
271275
CLANG_ENABLE_MODULES = YES;
272276
CLANG_ENABLE_OBJC_ARC = YES;
277+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
273278
CLANG_WARN_BOOL_CONVERSION = YES;
279+
CLANG_WARN_COMMA = YES;
274280
CLANG_WARN_CONSTANT_CONVERSION = YES;
281+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
275282
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
276283
CLANG_WARN_EMPTY_BODY = YES;
277284
CLANG_WARN_ENUM_CONVERSION = YES;
278285
CLANG_WARN_INFINITE_RECURSION = YES;
279286
CLANG_WARN_INT_CONVERSION = YES;
287+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
288+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
289+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
280290
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
291+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
292+
CLANG_WARN_STRICT_PROTOTYPES = YES;
281293
CLANG_WARN_SUSPICIOUS_MOVE = YES;
282294
CLANG_WARN_UNREACHABLE_CODE = YES;
283295
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -315,18 +327,27 @@
315327
isa = XCBuildConfiguration;
316328
buildSettings = {
317329
ALWAYS_SEARCH_USER_PATHS = NO;
330+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
318331
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
319332
CLANG_CXX_LIBRARY = "libc++";
320333
CLANG_ENABLE_MODULES = YES;
321334
CLANG_ENABLE_OBJC_ARC = YES;
335+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
322336
CLANG_WARN_BOOL_CONVERSION = YES;
337+
CLANG_WARN_COMMA = YES;
323338
CLANG_WARN_CONSTANT_CONVERSION = YES;
339+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
324340
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325341
CLANG_WARN_EMPTY_BODY = YES;
326342
CLANG_WARN_ENUM_CONVERSION = YES;
327343
CLANG_WARN_INFINITE_RECURSION = YES;
328344
CLANG_WARN_INT_CONVERSION = YES;
345+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
346+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
347+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
329348
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
349+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
350+
CLANG_WARN_STRICT_PROTOTYPES = YES;
330351
CLANG_WARN_SUSPICIOUS_MOVE = YES;
331352
CLANG_WARN_UNREACHABLE_CODE = YES;
332353
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -368,8 +389,7 @@
368389
SKIP_INSTALL = YES;
369390
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
370391
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
371-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
372-
SWIFT_VERSION = 4.0;
392+
SWIFT_VERSION = 5.0;
373393
};
374394
name = Debug;
375395
};
@@ -388,8 +408,7 @@
388408
SKIP_INSTALL = YES;
389409
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
390410
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
391-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
392-
SWIFT_VERSION = 4.0;
411+
SWIFT_VERSION = 5.0;
393412
};
394413
name = Release;
395414
};
@@ -400,8 +419,7 @@
400419
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
401420
PRODUCT_BUNDLE_IDENTIFIER = com.nodes.KeyboardHelperTests;
402421
PRODUCT_NAME = "$(TARGET_NAME)";
403-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
404-
SWIFT_VERSION = 4.0;
422+
SWIFT_VERSION = 5.0;
405423
};
406424
name = Debug;
407425
};
@@ -413,8 +431,7 @@
413431
PRODUCT_BUNDLE_IDENTIFIER = com.nodes.KeyboardHelperTests;
414432
PRODUCT_NAME = "$(TARGET_NAME)";
415433
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
416-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
417-
SWIFT_VERSION = 4.0;
434+
SWIFT_VERSION = 5.0;
418435
};
419436
name = Release;
420437
};

KeyboardHelper.xcodeproj/xcshareddata/xcschemes/KeyboardHelper.xcscheme

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0810"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,18 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
codeCoverageEnabled = "YES"
30+
onlyGenerateCoverageForSpecifiedTargets = "YES"
2931
shouldUseLaunchSchemeArgsEnv = "YES">
32+
<CodeCoverageTargets>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "275BCA761C57C9F800FF3647"
36+
BuildableName = "KeyboardHelper.framework"
37+
BlueprintName = "KeyboardHelper"
38+
ReferencedContainer = "container:KeyboardHelper.xcodeproj">
39+
</BuildableReference>
40+
</CodeCoverageTargets>
3041
<Testables>
3142
<TestableReference
3243
skipped = "NO">

KeyboardHelper/Classes/KeyboardAppearanceInfo.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public struct KeyboardAppearanceInfo {
2222

2323
/// Getter for the UIKeyboard frame begin infokey. Returns a `CGRect` or `CGRectZero`.
2424
public var beginFrame: CGRect {
25-
return (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
25+
return (userInfo[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
2626
}
2727

2828

2929
/// Getter for the UIKeyboard frame end infokey. Return a `CGRect` or `CGRectZero`.
3030
public var endFrame: CGRect {
31-
return (userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
31+
return (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
3232
}
3333

3434

@@ -37,29 +37,29 @@ public struct KeyboardAppearanceInfo {
3737
/// That variable will help to keep track of which app uses the keyboard at the moment.
3838
/// If it is the current app it is true, if not it is false.
3939
public var belongsToCurrentApp: Bool {
40-
return (userInfo[UIKeyboardIsLocalUserInfoKey] as? Bool) ?? true
40+
return (userInfo[UIResponder.keyboardIsLocalUserInfoKey] as? Bool) ?? true
4141

4242
}
4343

4444

4545
/// Getter for the duration of the keyboard appear/disappear animation.
4646
/// By default: `0.25`.
4747
public var animationDuration: Double {
48-
return (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.25
48+
return (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.25
4949
}
5050

5151
/// Getter for the animation curve.
5252
/// By default: `EaseInOut`.
53-
public var animationCurve: UIViewAnimationCurve {
54-
guard let value = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? Int else { return .easeInOut }
55-
return UIViewAnimationCurve(rawValue: value) ?? .easeInOut
53+
public var animationCurve: UIView.AnimationCurve {
54+
guard let value = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? Int else { return .easeInOut }
55+
return UIView.AnimationCurve(rawValue: value) ?? .easeInOut
5656
}
5757

5858

5959
/// Getter for the animation option.
6060
/// That variable will help to keep track of the keyboard appearence.
61-
public var animationOptions: UIViewAnimationOptions {
62-
return UIViewAnimationOptions(rawValue: UInt(animationCurve.rawValue << 16))
61+
public var animationOptions: UIView.AnimationOptions {
62+
return UIView.AnimationOptions(rawValue: UInt(animationCurve.rawValue << 16))
6363
}
6464

6565
/// Animate a `UView` while the keyboard appears and check if animation is finished.

KeyboardHelper/Classes/KeyboardHelper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public class KeyboardHelper {
4545
required public init(delegate: KeyboardHelperDelegate) {
4646
self.delegate = delegate
4747

48-
NotificationCenter.default.addObserver(self, selector: #selector(KeyboardHelper.keyboardWillAppear(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
49-
NotificationCenter.default.addObserver(self, selector: #selector(KeyboardHelper.keyboardWillDisappear(_:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
48+
NotificationCenter.default.addObserver(self, selector: #selector(KeyboardHelper.keyboardWillAppear(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
49+
NotificationCenter.default.addObserver(self, selector: #selector(KeyboardHelper.keyboardWillDisappear(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
5050
}
5151

5252

KeyboardHelper/Supporting Files/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
18+
<string>3.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

KeyboardHelperTests/Tests/KeyboardAppearanceInfoTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ class KeyboardAppearanceInfoTests: XCTestCase {
1919

2020
// Create test info
2121
var testUserInfo: [String: Any] = [
22-
UIKeyboardFrameBeginUserInfoKey: NSValue(cgRect: CGRect(x: 100, y: 100, width: 100, height: 100)),
23-
UIKeyboardFrameEndUserInfoKey: NSValue(cgRect: CGRect(x: 200, y: 200, width: 200, height: 200)),
24-
UIKeyboardAnimationDurationUserInfoKey: 3.0,
25-
UIKeyboardAnimationCurveUserInfoKey: NSNumber(integerLiteral: UIViewAnimationCurve.easeOut.rawValue),
22+
UIResponder.keyboardFrameBeginUserInfoKey: NSValue(cgRect: CGRect(x: 100, y: 100, width: 100, height: 100)),
23+
UIResponder.keyboardFrameEndUserInfoKey: NSValue(cgRect: CGRect(x: 200, y: 200, width: 200, height: 200)),
24+
UIResponder.keyboardAnimationDurationUserInfoKey: 3.0,
25+
UIResponder.keyboardAnimationCurveUserInfoKey: NSNumber(integerLiteral: UIView.AnimationCurve.easeOut.rawValue),
2626
]
2727

2828
if #available(iOS 9.0, *) {
29-
testUserInfo[UIKeyboardIsLocalUserInfoKey] = false
29+
testUserInfo[UIResponder.keyboardIsLocalUserInfoKey] = false
3030
} else {
3131
print("UIKeyboardIsLocalUserInfoKey is not available before iOS9.")
3232
}
3333

3434
// Fake the notification
35-
let note = Notification(name: NSNotification.Name.UIKeyboardWillShow, object: nil, userInfo: testUserInfo)
35+
let note = Notification(name: UIResponder.keyboardWillShowNotification, object: nil, userInfo: testUserInfo)
3636
appearanceInfo = KeyboardAppearanceInfo(notification: note)
37-
let defaultNote = Notification(name: NSNotification.Name.UIKeyboardWillShow, object: nil, userInfo: nil)
37+
let defaultNote = Notification(name: UIResponder.keyboardWillShowNotification, object: nil, userInfo: nil)
3838
defaultsAppearanceInfo = KeyboardAppearanceInfo(notification: defaultNote)
3939
}
4040

@@ -69,9 +69,9 @@ class KeyboardAppearanceInfoTests: XCTestCase {
6969
}
7070

7171
func testAnimationCurve() {
72-
XCTAssertEqual(appearanceInfo.animationCurve, UIViewAnimationCurve.easeOut,
72+
XCTAssertEqual(appearanceInfo.animationCurve, UIView.AnimationCurve.easeOut,
7373
"Parsing animationCurve from keyboard appearance info failed.")
74-
XCTAssertEqual(defaultsAppearanceInfo.animationCurve, UIViewAnimationCurve.easeInOut,
74+
XCTAssertEqual(defaultsAppearanceInfo.animationCurve, UIView.AnimationCurve.easeInOut,
7575
"Parsing default animationCurve from keyboard appearance info failed.")
7676
}
7777

0 commit comments

Comments
 (0)