Skip to content

Commit cf6de28

Browse files
committed
Upgrade to swift 4 and fix warnings
1 parent 513ada9 commit cf6de28

5 files changed

Lines changed: 32 additions & 14 deletions

File tree

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2
1+
4.0

Example/KWVerificationCodeView.xcodeproj/project.pbxproj

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@
213213
isa = PBXProject;
214214
attributes = {
215215
LastSwiftUpdateCheck = 0720;
216-
LastUpgradeCheck = 0820;
216+
LastUpgradeCheck = 0920;
217217
ORGANIZATIONNAME = CocoaPods;
218218
TargetAttributes = {
219219
607FACCF1AFB9204008FA782 = {
220220
CreatedOnToolsVersion = 6.3.1;
221-
LastSwiftMigration = 0820;
221+
LastSwiftMigration = 0920;
222222
};
223223
607FACE41AFB9204008FA782 = {
224224
CreatedOnToolsVersion = 6.3.1;
@@ -425,14 +425,20 @@
425425
CLANG_CXX_LIBRARY = "libc++";
426426
CLANG_ENABLE_MODULES = YES;
427427
CLANG_ENABLE_OBJC_ARC = YES;
428+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
428429
CLANG_WARN_BOOL_CONVERSION = YES;
430+
CLANG_WARN_COMMA = YES;
429431
CLANG_WARN_CONSTANT_CONVERSION = YES;
430432
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
431433
CLANG_WARN_EMPTY_BODY = YES;
432434
CLANG_WARN_ENUM_CONVERSION = YES;
433435
CLANG_WARN_INFINITE_RECURSION = YES;
434436
CLANG_WARN_INT_CONVERSION = YES;
437+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
438+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
435439
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
440+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
441+
CLANG_WARN_STRICT_PROTOTYPES = YES;
436442
CLANG_WARN_SUSPICIOUS_MOVE = YES;
437443
CLANG_WARN_UNREACHABLE_CODE = YES;
438444
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -461,6 +467,7 @@
461467
ONLY_ACTIVE_ARCH = YES;
462468
SDKROOT = iphoneos;
463469
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
470+
SWIFT_VERSION = 4.0;
464471
};
465472
name = Debug;
466473
};
@@ -472,14 +479,20 @@
472479
CLANG_CXX_LIBRARY = "libc++";
473480
CLANG_ENABLE_MODULES = YES;
474481
CLANG_ENABLE_OBJC_ARC = YES;
482+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
475483
CLANG_WARN_BOOL_CONVERSION = YES;
484+
CLANG_WARN_COMMA = YES;
476485
CLANG_WARN_CONSTANT_CONVERSION = YES;
477486
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
478487
CLANG_WARN_EMPTY_BODY = YES;
479488
CLANG_WARN_ENUM_CONVERSION = YES;
480489
CLANG_WARN_INFINITE_RECURSION = YES;
481490
CLANG_WARN_INT_CONVERSION = YES;
491+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
492+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
482493
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
494+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
495+
CLANG_WARN_STRICT_PROTOTYPES = YES;
483496
CLANG_WARN_SUSPICIOUS_MOVE = YES;
484497
CLANG_WARN_UNREACHABLE_CODE = YES;
485498
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -500,6 +513,7 @@
500513
MTL_ENABLE_DEBUG_INFO = NO;
501514
SDKROOT = iphoneos;
502515
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
516+
SWIFT_VERSION = 4.0;
503517
VALIDATE_PRODUCT = YES;
504518
};
505519
name = Release;
@@ -517,8 +531,9 @@
517531
MODULE_NAME = ExampleApp;
518532
PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example";
519533
PRODUCT_NAME = "$(TARGET_NAME)";
520-
SWIFT_VERSION = 3.0;
521-
TARGETED_DEVICE_FAMILY = "1,2";
534+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
535+
SWIFT_VERSION = 4.0;
536+
TARGETED_DEVICE_FAMILY = 1;
522537
};
523538
name = Debug;
524539
};
@@ -535,8 +550,9 @@
535550
MODULE_NAME = ExampleApp;
536551
PRODUCT_BUNDLE_IDENTIFIER = "com.keepworks.KWVerificationCodeView-Example";
537552
PRODUCT_NAME = "$(TARGET_NAME)";
538-
SWIFT_VERSION = 3.0;
539-
TARGETED_DEVICE_FAMILY = "1,2";
553+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
554+
SWIFT_VERSION = 4.0;
555+
TARGETED_DEVICE_FAMILY = 1;
540556
};
541557
name = Release;
542558
};
@@ -554,7 +570,7 @@
554570
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
555571
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
556572
PRODUCT_NAME = "$(TARGET_NAME)";
557-
SWIFT_VERSION = 3.0;
573+
SWIFT_VERSION = 4.0;
558574
};
559575
name = Debug;
560576
};
@@ -568,7 +584,7 @@
568584
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
569585
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
570586
PRODUCT_NAME = "$(TARGET_NAME)";
571-
SWIFT_VERSION = 3.0;
587+
SWIFT_VERSION = 4.0;
572588
};
573589
name = Release;
574590
};

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

Lines changed: 3 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 = "0820"
3+
LastUpgradeVersion = "0920"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
language = ""
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<Testables>
4546
<TestableReference
@@ -69,6 +70,7 @@
6970
buildConfiguration = "Debug"
7071
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7172
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73+
language = ""
7274
launchStyle = "0"
7375
useCustomWorkingDirectory = "NO"
7476
ignoresPersistentStateOnLaunch = "NO"

KWVerificationCodeView/Classes/KWTextFieldView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protocol KWTextFieldDelegate: class {
103103
loadViewFromNib()
104104
numberTextField.delegate = self
105105
numberTextField.autocorrectionType = UITextAutocorrectionType.no
106-
106+
107107
NotificationCenter.default.addObserver(self, selector: #selector(textFieldDidChange(_:)), name: NSNotification.Name.UITextFieldTextDidChange, object: numberTextField)
108108
}
109109

@@ -125,7 +125,7 @@ protocol KWTextFieldDelegate: class {
125125
}
126126

127127
// MARK: - FilePrivate Methods
128-
dynamic fileprivate func textFieldDidChange(_ notification: Foundation.Notification) {
128+
@objc dynamic fileprivate func textFieldDidChange(_ notification: Foundation.Notification) {
129129
if numberTextField.text?.count == 0 {
130130
numberTextField.text = " "
131131
}

KWVerificationCodeView/Classes/KWVerificationCodeView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ public protocol KWVerificationCodeViewDelegate: class {
171171
for textFieldView in textFieldViews {
172172
textFieldView.numberTextField.text = ""
173173
}
174-
174+
175175
textFieldViews[0].activate()
176176
}
177-
177+
178178
// MARK: - Private Methods
179179
private func setup() {
180180
loadViewFromNib()

0 commit comments

Comments
 (0)