Skip to content

Commit 1d252a5

Browse files
author
Aaron McTavish
authored
Xcode 9 and Swift 4 Support (#65)
* Xcode Migration to Swift 4 * Update Travis to Xcode 9.1 Image * Update swift-version to 4.0 * Fix difference on tvOS for recordFailure in Unit Test suite * Update Ruby dev dependencies
1 parent e9a9614 commit 1d252a5

28 files changed

+200
-126
lines changed

.swift-version

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
osx_image: xcode8.3
1+
osx_image: xcode9.1
22
language: objective-c
33

44
env:

Example/iOS/FormView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ final class FormView: UIView {
6060
submitButton.setTitle(NSLocalizedString("Submit", comment: ""), for: UIControlState())
6161
stackView.addArrangedSubview(submitButton)
6262

63-
bottomBufferView.setContentCompressionResistancePriority(UILayoutPriorityDefaultLow, for: stackView.axis)
64-
bottomBufferView.setContentHuggingPriority(UILayoutPriorityDefaultLow, for: stackView.axis)
63+
bottomBufferView.setContentCompressionResistancePriority(UILayoutPriority.defaultLow, for: stackView.axis)
64+
bottomBufferView.setContentHuggingPriority(UILayoutPriority.defaultLow, for: stackView.axis)
6565
stackView.addArrangedSubview(bottomBufferView)
6666

6767

Example/iOS/FormViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class FormViewController: UIViewController {
4747

4848
// MARK: - Control Actions
4949

50-
func submitButtonPressed(_ sender: UIButton) {
50+
@objc func submitButtonPressed(_ sender: UIButton) {
5151
let alertTitle: String
5252
let alertMessage: String
5353
if form.isValid {

Example/macOS/AppDelegate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1717
lazy var window: NSWindow = {
1818
let result = NSWindow(contentRect: NSRect(x: 0,
1919
y: 0,
20-
width: NSScreen.main()!.frame.width / 2.0,
21-
height: NSScreen.main()!.frame.height / 2.0),
22-
styleMask: [.titled, .miniaturizable, .resizable, .closable],
20+
width: NSScreen.main!.frame.width / 2.0,
21+
height: NSScreen.main!.frame.height / 2.0),
22+
styleMask: [NSWindow.StyleMask.titled, NSWindow.StyleMask.miniaturizable, NSWindow.StyleMask.resizable, NSWindow.StyleMask.closable],
2323
backing: .buffered,
2424
defer: false)
2525

Example/macOS/FormViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class FormViewController: NSViewController {
4949

5050
// MARK: - Control Actions
5151

52-
func submitButtonPressed(_ sender: NSButton) {
52+
@objc func submitButtonPressed(_ sender: NSButton) {
5353
let alertMessage: String
5454
if form.isValid {
5555
alertMessage = NSLocalizedString("Success: Your data has been submitted!", comment: "")
@@ -61,7 +61,7 @@ final class FormViewController: NSViewController {
6161
alert.alertStyle = .critical
6262
alert.messageText = alertMessage
6363

64-
alert.beginSheetModal(for: NSApplication.shared().mainWindow!, completionHandler: nil)
64+
alert.beginSheetModal(for: NSApplication.shared.mainWindow!, completionHandler: nil)
6565
}
6666

6767
}

FormValidatorSwift.xcodeproj/project.pbxproj

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -817,32 +817,36 @@
817817
isa = PBXProject;
818818
attributes = {
819819
LastSwiftUpdateCheck = 0820;
820-
LastUpgradeCheck = 0800;
820+
LastUpgradeCheck = 0910;
821821
ORGANIZATIONNAME = ustwo;
822822
TargetAttributes = {
823823
0056755E1C47ED32005A43F0 = {
824824
CreatedOnToolsVersion = 7.2;
825+
LastSwiftMigration = 0910;
825826
};
826827
005675671C47ED32005A43F0 = {
827828
CreatedOnToolsVersion = 7.2;
829+
LastSwiftMigration = 0910;
828830
ProvisioningStyle = Manual;
829831
};
830832
0062E9CF1C45493E00021C0A = {
831833
CreatedOnToolsVersion = 7.2;
832-
LastSwiftMigration = 0800;
834+
LastSwiftMigration = 0910;
833835
};
834836
0062E9D91C45493E00021C0A = {
835837
CreatedOnToolsVersion = 7.2;
836-
LastSwiftMigration = 0800;
838+
LastSwiftMigration = 0910;
837839
ProvisioningStyle = Manual;
838840
};
839841
00AC81E71E1FB69200A184BB = {
840842
CreatedOnToolsVersion = 8.2.1;
843+
LastSwiftMigration = 0910;
841844
ProvisioningStyle = Manual;
842845
};
843846
00AC81EF1E1FB69200A184BB = {
844847
CreatedOnToolsVersion = 8.2.1;
845848
DevelopmentTeam = 4JC5M8RR29;
849+
LastSwiftMigration = 0910;
846850
ProvisioningStyle = Automatic;
847851
};
848852
};
@@ -1311,7 +1315,7 @@
13111315
PRODUCT_NAME = FormValidatorSwift;
13121316
SDKROOT = appletvos;
13131317
SKIP_INSTALL = YES;
1314-
SWIFT_VERSION = 3.0;
1318+
SWIFT_VERSION = 4.0;
13151319
TARGETED_DEVICE_FAMILY = 3;
13161320
TVOS_DEPLOYMENT_TARGET = 9.0;
13171321
};
@@ -1334,7 +1338,7 @@
13341338
PRODUCT_NAME = FormValidatorSwift;
13351339
SDKROOT = appletvos;
13361340
SKIP_INSTALL = YES;
1337-
SWIFT_VERSION = 3.0;
1341+
SWIFT_VERSION = 4.0;
13381342
TARGETED_DEVICE_FAMILY = 3;
13391343
TVOS_DEPLOYMENT_TARGET = 9.0;
13401344
};
@@ -1349,6 +1353,7 @@
13491353
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwiftTests;
13501354
PRODUCT_NAME = "$(TARGET_NAME)";
13511355
SDKROOT = appletvos;
1356+
SWIFT_VERSION = 4.0;
13521357
TVOS_DEPLOYMENT_TARGET = 9.1;
13531358
};
13541359
name = Debug;
@@ -1362,6 +1367,7 @@
13621367
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwiftTests;
13631368
PRODUCT_NAME = "$(TARGET_NAME)";
13641369
SDKROOT = appletvos;
1370+
SWIFT_VERSION = 4.0;
13651371
TVOS_DEPLOYMENT_TARGET = 9.1;
13661372
};
13671373
name = Release;
@@ -1375,14 +1381,20 @@
13751381
CLANG_CXX_LIBRARY = "libc++";
13761382
CLANG_ENABLE_MODULES = YES;
13771383
CLANG_ENABLE_OBJC_ARC = YES;
1384+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
13781385
CLANG_WARN_BOOL_CONVERSION = YES;
1386+
CLANG_WARN_COMMA = YES;
13791387
CLANG_WARN_CONSTANT_CONVERSION = YES;
13801388
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
13811389
CLANG_WARN_EMPTY_BODY = YES;
13821390
CLANG_WARN_ENUM_CONVERSION = YES;
13831391
CLANG_WARN_INFINITE_RECURSION = YES;
13841392
CLANG_WARN_INT_CONVERSION = YES;
1393+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1394+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
13851395
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1396+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
1397+
CLANG_WARN_STRICT_PROTOTYPES = YES;
13861398
CLANG_WARN_SUSPICIOUS_MOVE = YES;
13871399
CLANG_WARN_UNREACHABLE_CODE = YES;
13881400
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1428,14 +1440,20 @@
14281440
CLANG_CXX_LIBRARY = "libc++";
14291441
CLANG_ENABLE_MODULES = YES;
14301442
CLANG_ENABLE_OBJC_ARC = YES;
1443+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
14311444
CLANG_WARN_BOOL_CONVERSION = YES;
1445+
CLANG_WARN_COMMA = YES;
14321446
CLANG_WARN_CONSTANT_CONVERSION = YES;
14331447
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
14341448
CLANG_WARN_EMPTY_BODY = YES;
14351449
CLANG_WARN_ENUM_CONVERSION = YES;
14361450
CLANG_WARN_INFINITE_RECURSION = YES;
14371451
CLANG_WARN_INT_CONVERSION = YES;
1452+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1453+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
14381454
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1455+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
1456+
CLANG_WARN_STRICT_PROTOTYPES = YES;
14391457
CLANG_WARN_SUSPICIOUS_MOVE = YES;
14401458
CLANG_WARN_UNREACHABLE_CODE = YES;
14411459
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1484,7 +1502,7 @@
14841502
PRODUCT_NAME = FormValidatorSwift;
14851503
SKIP_INSTALL = YES;
14861504
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1487-
SWIFT_VERSION = 3.0;
1505+
SWIFT_VERSION = 4.0;
14881506
};
14891507
name = Debug;
14901508
};
@@ -1505,7 +1523,7 @@
15051523
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwift;
15061524
PRODUCT_NAME = FormValidatorSwift;
15071525
SKIP_INSTALL = YES;
1508-
SWIFT_VERSION = 3.0;
1526+
SWIFT_VERSION = 4.0;
15091527
};
15101528
name = Release;
15111529
};
@@ -1517,7 +1535,7 @@
15171535
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
15181536
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwiftTests;
15191537
PRODUCT_NAME = "$(TARGET_NAME)";
1520-
SWIFT_VERSION = 3.0;
1538+
SWIFT_VERSION = 4.0;
15211539
};
15221540
name = Debug;
15231541
};
@@ -1529,7 +1547,7 @@
15291547
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
15301548
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwiftTests;
15311549
PRODUCT_NAME = "$(TARGET_NAME)";
1532-
SWIFT_VERSION = 3.0;
1550+
SWIFT_VERSION = 4.0;
15331551
};
15341552
name = Release;
15351553
};
@@ -1556,7 +1574,7 @@
15561574
SDKROOT = macosx;
15571575
SKIP_INSTALL = YES;
15581576
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
1559-
SWIFT_VERSION = 3.0;
1577+
SWIFT_VERSION = 4.0;
15601578
};
15611579
name = Debug;
15621580
};
@@ -1582,7 +1600,7 @@
15821600
PRODUCT_NAME = FormValidatorSwift;
15831601
SDKROOT = macosx;
15841602
SKIP_INSTALL = YES;
1585-
SWIFT_VERSION = 3.0;
1603+
SWIFT_VERSION = 4.0;
15861604
};
15871605
name = Release;
15881606
};
@@ -1602,7 +1620,7 @@
16021620
PRODUCT_NAME = "$(TARGET_NAME)";
16031621
SDKROOT = macosx;
16041622
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
1605-
SWIFT_VERSION = 3.0;
1623+
SWIFT_VERSION = 4.0;
16061624
};
16071625
name = Debug;
16081626
};
@@ -1621,7 +1639,7 @@
16211639
PRODUCT_BUNDLE_IDENTIFIER = com.ustwo.FormValidatorSwiftTests;
16221640
PRODUCT_NAME = "$(TARGET_NAME)";
16231641
SDKROOT = macosx;
1624-
SWIFT_VERSION = 3.0;
1642+
SWIFT_VERSION = 4.0;
16251643
};
16261644
name = Release;
16271645
};

FormValidatorSwift.xcodeproj/xcshareddata/xcschemes/FormValidatorSwift iOS.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 = "0910"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES"
3031
codeCoverageEnabled = "YES">
3132
<Testables>
@@ -56,6 +57,7 @@
5657
buildConfiguration = "Debug"
5758
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5859
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
60+
language = ""
5961
launchStyle = "0"
6062
useCustomWorkingDirectory = "NO"
6163
ignoresPersistentStateOnLaunch = "NO"

FormValidatorSwift.xcodeproj/xcshareddata/xcschemes/FormValidatorSwift macOS.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 = "0910"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES"
3031
codeCoverageEnabled = "YES">
3132
<Testables>
@@ -56,6 +57,7 @@
5657
buildConfiguration = "Debug"
5758
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5859
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
60+
language = ""
5961
launchStyle = "0"
6062
useCustomWorkingDirectory = "NO"
6163
ignoresPersistentStateOnLaunch = "NO"

FormValidatorSwift.xcodeproj/xcshareddata/xcschemes/FormValidatorSwift tvOS.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 = "0910"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
<TestableReference
@@ -55,6 +56,7 @@
5556
buildConfiguration = "Debug"
5657
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5758
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
5860
launchStyle = "0"
5961
useCustomWorkingDirectory = "NO"
6062
ignoresPersistentStateOnLaunch = "NO"

0 commit comments

Comments
 (0)