Skip to content

Commit 5378750

Browse files
firozkhursheedkpavankotesh
authored andcommitted
Swift 4.2 updates (#26)
* Support for Swift 4.2; Xcode 10 - v0.3.0 * Update example project
1 parent 0b4164d commit 5378750

9 files changed

Lines changed: 48 additions & 83 deletions

File tree

Example/KWVerificationCodeView.xcodeproj/project.pbxproj

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
C68BD3F967305D340EA20FFD /* Pods_KWVerificationCodeView_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KWVerificationCodeView_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4848
D1AA5A4C20D0FD7B007FE474 /* ProgramaticalVerificationCodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgramaticalVerificationCodeViewController.swift; sourceTree = "<group>"; };
4949
D51BF4885572F8FECD1E4AF7 /* Pods-KWVerificationCodeView_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KWVerificationCodeView_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example.debug.xcconfig"; sourceTree = "<group>"; };
50-
E6C0C121AF93D56E0FE9F947 /* KWVerificationCodeView.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = KWVerificationCodeView.podspec; path = ../KWVerificationCodeView.podspec; sourceTree = "<group>"; };
50+
E6C0C121AF93D56E0FE9F947 /* KWVerificationCodeView.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = KWVerificationCodeView.podspec; path = ../KWVerificationCodeView.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
5151
F538A5E79FE77B8D323F9B7B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
5252
/* End PBXFileReference section */
5353

@@ -174,7 +174,6 @@
174174
607FACCD1AFB9204008FA782 /* Frameworks */,
175175
607FACCE1AFB9204008FA782 /* Resources */,
176176
577FAF386CE51F89750D85AF /* [CP] Embed Pods Frameworks */,
177-
829634171A971BCD9370CC97 /* [CP] Copy Pods Resources */,
178177
);
179178
buildRules = (
180179
);
@@ -193,8 +192,6 @@
193192
607FACE11AFB9204008FA782 /* Sources */,
194193
607FACE21AFB9204008FA782 /* Frameworks */,
195194
607FACE31AFB9204008FA782 /* Resources */,
196-
CBA7B196B73A5116959ADE29 /* [CP] Embed Pods Frameworks */,
197-
E561E3AAD048FA052255B138 /* [CP] Copy Pods Resources */,
198195
);
199196
buildRules = (
200197
);
@@ -213,16 +210,16 @@
213210
isa = PBXProject;
214211
attributes = {
215212
LastSwiftUpdateCheck = 0720;
216-
LastUpgradeCheck = 0920;
213+
LastUpgradeCheck = 1010;
217214
ORGANIZATIONNAME = CocoaPods;
218215
TargetAttributes = {
219216
607FACCF1AFB9204008FA782 = {
220217
CreatedOnToolsVersion = 6.3.1;
221-
LastSwiftMigration = 0920;
218+
LastSwiftMigration = 1010;
222219
};
223220
607FACE41AFB9204008FA782 = {
224221
CreatedOnToolsVersion = 6.3.1;
225-
LastSwiftMigration = 0820;
222+
LastSwiftMigration = 1010;
226223
TestTargetID = 607FACCF1AFB9204008FA782;
227224
};
228225
};
@@ -285,21 +282,6 @@
285282
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-frameworks.sh\"\n";
286283
showEnvVarsInLog = 0;
287284
};
288-
829634171A971BCD9370CC97 /* [CP] Copy Pods Resources */ = {
289-
isa = PBXShellScriptBuildPhase;
290-
buildActionMask = 2147483647;
291-
files = (
292-
);
293-
inputPaths = (
294-
);
295-
name = "[CP] Copy Pods Resources";
296-
outputPaths = (
297-
);
298-
runOnlyForDeploymentPostprocessing = 0;
299-
shellPath = /bin/sh;
300-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Example/Pods-KWVerificationCodeView_Example-resources.sh\"\n";
301-
showEnvVarsInLog = 0;
302-
};
303285
8A96BB52F0E82B4C4B2EC0C9 /* [CP] Check Pods Manifest.lock */ = {
304286
isa = PBXShellScriptBuildPhase;
305287
buildActionMask = 2147483647;
@@ -336,36 +318,6 @@
336318
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
337319
showEnvVarsInLog = 0;
338320
};
339-
CBA7B196B73A5116959ADE29 /* [CP] Embed Pods Frameworks */ = {
340-
isa = PBXShellScriptBuildPhase;
341-
buildActionMask = 2147483647;
342-
files = (
343-
);
344-
inputPaths = (
345-
);
346-
name = "[CP] Embed Pods Frameworks";
347-
outputPaths = (
348-
);
349-
runOnlyForDeploymentPostprocessing = 0;
350-
shellPath = /bin/sh;
351-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Tests/Pods-KWVerificationCodeView_Tests-frameworks.sh\"\n";
352-
showEnvVarsInLog = 0;
353-
};
354-
E561E3AAD048FA052255B138 /* [CP] Copy Pods Resources */ = {
355-
isa = PBXShellScriptBuildPhase;
356-
buildActionMask = 2147483647;
357-
files = (
358-
);
359-
inputPaths = (
360-
);
361-
name = "[CP] Copy Pods Resources";
362-
outputPaths = (
363-
);
364-
runOnlyForDeploymentPostprocessing = 0;
365-
shellPath = /bin/sh;
366-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-KWVerificationCodeView_Tests/Pods-KWVerificationCodeView_Tests-resources.sh\"\n";
367-
showEnvVarsInLog = 0;
368-
};
369321
/* End PBXShellScriptBuildPhase section */
370322

371323
/* Begin PBXSourcesBuildPhase section */
@@ -429,12 +381,14 @@
429381
CLANG_WARN_BOOL_CONVERSION = YES;
430382
CLANG_WARN_COMMA = YES;
431383
CLANG_WARN_CONSTANT_CONVERSION = YES;
384+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
432385
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
433386
CLANG_WARN_EMPTY_BODY = YES;
434387
CLANG_WARN_ENUM_CONVERSION = YES;
435388
CLANG_WARN_INFINITE_RECURSION = YES;
436389
CLANG_WARN_INT_CONVERSION = YES;
437390
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
391+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
438392
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
439393
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
440394
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -483,12 +437,14 @@
483437
CLANG_WARN_BOOL_CONVERSION = YES;
484438
CLANG_WARN_COMMA = YES;
485439
CLANG_WARN_CONSTANT_CONVERSION = YES;
440+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
486441
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
487442
CLANG_WARN_EMPTY_BODY = YES;
488443
CLANG_WARN_ENUM_CONVERSION = YES;
489444
CLANG_WARN_INFINITE_RECURSION = YES;
490445
CLANG_WARN_INT_CONVERSION = YES;
491446
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
447+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
492448
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
493449
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
494450
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -531,8 +487,7 @@
531487
MODULE_NAME = ExampleApp;
532488
PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example";
533489
PRODUCT_NAME = "$(TARGET_NAME)";
534-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
535-
SWIFT_VERSION = 4.0;
490+
SWIFT_VERSION = 4.2;
536491
TARGETED_DEVICE_FAMILY = 1;
537492
};
538493
name = Debug;
@@ -550,8 +505,7 @@
550505
MODULE_NAME = ExampleApp;
551506
PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example";
552507
PRODUCT_NAME = "$(TARGET_NAME)";
553-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
554-
SWIFT_VERSION = 4.0;
508+
SWIFT_VERSION = 4.2;
555509
TARGETED_DEVICE_FAMILY = 1;
556510
};
557511
name = Release;
@@ -570,7 +524,7 @@
570524
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
571525
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
572526
PRODUCT_NAME = "$(TARGET_NAME)";
573-
SWIFT_VERSION = 4.0;
527+
SWIFT_VERSION = 4.2;
574528
};
575529
name = Debug;
576530
};
@@ -584,7 +538,7 @@
584538
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
585539
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
586540
PRODUCT_NAME = "$(TARGET_NAME)";
587-
SWIFT_VERSION = 4.0;
541+
SWIFT_VERSION = 4.2;
588542
};
589543
name = Release;
590544
};

Example/KWVerificationCodeView.xcodeproj/xcshareddata/xcschemes/KWVerificationCodeView-Example.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0920"
3+
LastUpgradeVersion = "1010"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,7 +40,6 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43-
language = ""
4443
shouldUseLaunchSchemeArgsEnv = "YES">
4544
<Testables>
4645
<TestableReference
@@ -70,7 +69,6 @@
7069
buildConfiguration = "Debug"
7170
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7271
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73-
language = ""
7472
launchStyle = "0"
7573
useCustomWorkingDirectory = "NO"
7674
ignoresPersistentStateOnLaunch = "NO"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Example/KWVerificationCodeView/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

16-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
16+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1717
return true
1818
}
1919

Example/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
PODS:
2-
- KWVerificationCodeView (0.2.0)
2+
- KWVerificationCodeView (0.3.0)
33

44
DEPENDENCIES:
55
- KWVerificationCodeView (from `../`)
66

77
EXTERNAL SOURCES:
88
KWVerificationCodeView:
9-
:path: ../
9+
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
KWVerificationCodeView: af71b4387c379ae52e8620b1f6a0ca334fc285b4
12+
KWVerificationCodeView: f9ad2952977379d34752a61967dd9b4cca3c0cde
1313

1414
PODFILE CHECKSUM: c5456285278196ae1d72df7acbfd1db2fab11376
1515

16-
COCOAPODS: 1.3.1
16+
COCOAPODS: 1.5.3

KWVerificationCodeView.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'KWVerificationCodeView'
3-
s.version = '0.2.0'
3+
s.version = '0.3.0'
44
s.summary = 'A verification code view with validation.'
55
s.description = 'A customisable verification code view with built in validation. Can be used for one time passwords (OTPs), email verification codes etc.'
66
s.homepage = 'https://github.com/keepworks/kwverificationcodeview'

KWVerificationCodeView/Classes/KWTextFieldView.swift

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@ protocol KWTextFieldDelegate: class {
9898
NotificationCenter.default.removeObserver(self)
9999
}
100100

101-
// MARK: - Private Methods
102-
private func setup() {
103-
loadViewFromNib()
104-
numberTextField.delegate = self
105-
numberTextField.autocorrectionType = UITextAutocorrectionType.no
106-
107-
NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidChange(_:)), name: UITextField.textDidChangeNotification, object: numberTextField)
108-
}
109-
110101
// MARK: - Public Methods
111102
public func activate() {
112103
numberTextField.becomeFirstResponder()
@@ -124,16 +115,24 @@ protocol KWTextFieldDelegate: class {
124115
updateUnderline()
125116
}
126117

127-
// MARK: - FilePrivate Methods
128-
@objc dynamic fileprivate func textFieldDidChange(_ notification: Foundation.Notification) {
129-
if numberTextField.text?.count == 0 {
130-
numberTextField.text = " "
131-
}
118+
// MARK: - Private Methods
119+
private func setup() {
120+
loadViewFromNib()
121+
numberTextField.delegate = self
122+
numberTextField.autocorrectionType = UITextAutocorrectionType.no
123+
124+
NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidChange(_:)), name: UITextField.textDidChangeNotification, object: numberTextField)
132125
}
133126

134-
fileprivate func updateUnderline() {
127+
private func updateUnderline() {
135128
underlineView.backgroundColor = numberTextField.text?.trim() != "" ? underlineSelectedColor : underlineColor
136129
}
130+
131+
@objc private func textFieldDidChange(_ notification: Foundation.Notification) {
132+
if numberTextField.text?.count == 0 {
133+
numberTextField.text = " "
134+
}
135+
}
137136
}
138137

139138
// MARK: - UITextFieldDelegate

KWVerificationCodeView/Classes/KWVerificationCodeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public protocol KWVerificationCodeViewDelegate: class {
116116
}
117117
}
118118

119-
fileprivate var textFieldViews = [KWTextFieldView]()
119+
private var textFieldViews = [KWTextFieldView]()
120120
private var keyboardAppearance = UIKeyboardAppearance.default
121121
private var textFieldFont = UIFont.systemFont(ofSize: 24.0)
122122
private var requiredDigits: UInt8 {

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ it, simply add the following line to your Podfile:
2525
```ruby
2626
pod "KWVerificationCodeView"
2727
```
28+
29+
Or for xcode 9 use:
30+
```ruby
31+
pod "KWVerificationCodeView", '0.2.0'
32+
```
33+
2834
## Usage
2935

3036
Add a `UIView` in your *Storyboard* and change the class to `KWVerificationCodeView`. You can set the properties in the *Attributes Inspector* and see a live preview:

0 commit comments

Comments
 (0)