Skip to content

Commit cda726d

Browse files
committed
Update for Xcode 11 and Swift 5
1 parent 45c9ce5 commit cda726d

10 files changed

Lines changed: 83 additions & 64 deletions

File tree

KeyCommand/KeyCommand.xcodeproj/project.pbxproj

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 52;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -186,7 +186,7 @@
186186
isa = PBXProject;
187187
attributes = {
188188
LastSwiftUpdateCheck = 0810;
189-
LastUpgradeCheck = 0900;
189+
LastUpgradeCheck = 1120;
190190
ORGANIZATIONNAME = "Keith Harrison";
191191
TargetAttributes = {
192192
5320051C1DD516C300EEFEE6 = {
@@ -197,14 +197,14 @@
197197
5334D0761DD3B6250032CB00 = {
198198
CreatedOnToolsVersion = 8.1;
199199
DevelopmentTeam = LCC2J94N44;
200-
LastSwiftMigration = 0900;
200+
LastSwiftMigration = 1120;
201201
ProvisioningStyle = Automatic;
202202
};
203203
};
204204
};
205205
buildConfigurationList = 5334D0721DD3B6250032CB00 /* Build configuration list for PBXProject "KeyCommand" */;
206-
compatibilityVersion = "Xcode 3.2";
207-
developmentRegion = English;
206+
compatibilityVersion = "Xcode 11.0";
207+
developmentRegion = en;
208208
hasScannedForEncodings = 0;
209209
knownRegions = (
210210
en,
@@ -317,7 +317,10 @@
317317
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
318318
DEVELOPMENT_TEAM = LCC2J94N44;
319319
INFOPLIST_FILE = KeyCommandObjC/Info.plist;
320-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
320+
LD_RUNPATH_SEARCH_PATHS = (
321+
"$(inherited)",
322+
"@executable_path/Frameworks",
323+
);
321324
PRODUCT_BUNDLE_IDENTIFIER = com.useyourloaf.KeyCommandObjC;
322325
PRODUCT_NAME = "$(TARGET_NAME)";
323326
};
@@ -329,7 +332,10 @@
329332
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
330333
DEVELOPMENT_TEAM = LCC2J94N44;
331334
INFOPLIST_FILE = KeyCommandObjC/Info.plist;
332-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
335+
LD_RUNPATH_SEARCH_PATHS = (
336+
"$(inherited)",
337+
"@executable_path/Frameworks",
338+
);
333339
PRODUCT_BUNDLE_IDENTIFIER = com.useyourloaf.KeyCommandObjC;
334340
PRODUCT_NAME = "$(TARGET_NAME)";
335341
};
@@ -339,6 +345,7 @@
339345
isa = XCBuildConfiguration;
340346
buildSettings = {
341347
ALWAYS_SEARCH_USER_PATHS = NO;
348+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
342349
CLANG_ANALYZER_NONNULL = YES;
343350
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
344351
CLANG_CXX_LIBRARY = "libc++";
@@ -348,13 +355,15 @@
348355
CLANG_WARN_BOOL_CONVERSION = YES;
349356
CLANG_WARN_COMMA = YES;
350357
CLANG_WARN_CONSTANT_CONVERSION = YES;
358+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
351359
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
352360
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
353361
CLANG_WARN_EMPTY_BODY = YES;
354362
CLANG_WARN_ENUM_CONVERSION = YES;
355363
CLANG_WARN_INFINITE_RECURSION = YES;
356364
CLANG_WARN_INT_CONVERSION = YES;
357365
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
366+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
358367
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
359368
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
360369
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -396,6 +405,7 @@
396405
isa = XCBuildConfiguration;
397406
buildSettings = {
398407
ALWAYS_SEARCH_USER_PATHS = NO;
408+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
399409
CLANG_ANALYZER_NONNULL = YES;
400410
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
401411
CLANG_CXX_LIBRARY = "libc++";
@@ -405,13 +415,15 @@
405415
CLANG_WARN_BOOL_CONVERSION = YES;
406416
CLANG_WARN_COMMA = YES;
407417
CLANG_WARN_CONSTANT_CONVERSION = YES;
418+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
408419
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
409420
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
410421
CLANG_WARN_EMPTY_BODY = YES;
411422
CLANG_WARN_ENUM_CONVERSION = YES;
412423
CLANG_WARN_INFINITE_RECURSION = YES;
413424
CLANG_WARN_INT_CONVERSION = YES;
414425
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
426+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
415427
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
416428
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
417429
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -436,7 +448,8 @@
436448
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
437449
MTL_ENABLE_DEBUG_INFO = NO;
438450
SDKROOT = iphoneos;
439-
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
451+
SWIFT_COMPILATION_MODE = wholemodule;
452+
SWIFT_OPTIMIZATION_LEVEL = "-O";
440453
TARGETED_DEVICE_FAMILY = 2;
441454
VALIDATE_PRODUCT = YES;
442455
};
@@ -448,11 +461,15 @@
448461
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
449462
DEVELOPMENT_TEAM = LCC2J94N44;
450463
INFOPLIST_FILE = KeyCommand/Info.plist;
451-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
464+
LD_RUNPATH_SEARCH_PATHS = (
465+
"$(inherited)",
466+
"@executable_path/Frameworks",
467+
);
468+
MARKETING_VERSION = 1.2;
452469
PRODUCT_BUNDLE_IDENTIFIER = com.useyourloaf.KeyCommand;
453470
PRODUCT_NAME = "$(TARGET_NAME)";
454471
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
455-
SWIFT_VERSION = 4.0;
472+
SWIFT_VERSION = 5.0;
456473
};
457474
name = Debug;
458475
};
@@ -462,11 +479,15 @@
462479
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
463480
DEVELOPMENT_TEAM = LCC2J94N44;
464481
INFOPLIST_FILE = KeyCommand/Info.plist;
465-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
482+
LD_RUNPATH_SEARCH_PATHS = (
483+
"$(inherited)",
484+
"@executable_path/Frameworks",
485+
);
486+
MARKETING_VERSION = 1.2;
466487
PRODUCT_BUNDLE_IDENTIFIER = com.useyourloaf.KeyCommand;
467488
PRODUCT_NAME = "$(TARGET_NAME)";
468489
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
469-
SWIFT_VERSION = 4.0;
490+
SWIFT_VERSION = 5.0;
470491
};
471492
name = Release;
472493
};

KeyCommand/KeyCommand/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
"idiom" : "ipad",
5454
"filename" : "cmd167.png",
5555
"scale" : "2x"
56+
},
57+
{
58+
"size" : "1024x1024",
59+
"idiom" : "ios-marketing",
60+
"filename" : "cmd1024.png",
61+
"scale" : "1x"
5662
}
5763
],
5864
"info" : {
29.7 KB
Loading

KeyCommand/KeyCommand/Base.lproj/Main.storyboard

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="8Gs-Ir-fuX">
3-
<device id="ipad9_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="8Gs-Ir-fuX">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
97
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
108
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
119
</dependencies>
@@ -15,11 +13,11 @@
1513
<objects>
1614
<viewController id="BYZ-38-t0r" customClass="OptionViewController" customModule="KeyCommand" customModuleProvider="target" sceneMemberID="viewController">
1715
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
18-
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
16+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1917
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2018
<subviews>
2119
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="48" translatesAutoresizingMaskIntoConstraints="NO" id="iZK-2V-XmM">
22-
<rect key="frame" x="341.5" y="402.5" width="85" height="219"/>
20+
<rect key="frame" x="145" y="224" width="85" height="219"/>
2321
<subviews>
2422
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pqK-Du-yh1">
2523
<rect key="frame" x="0.0" y="0.0" width="85" height="41"/>
@@ -59,18 +57,18 @@
5957
</viewController>
6058
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
6159
</objects>
62-
<point key="canvasLocation" x="801.5625" y="38.671875"/>
60+
<point key="canvasLocation" x="764" y="37"/>
6361
</scene>
6462
<!--none-->
6563
<scene sceneID="ixf-dM-qNZ">
6664
<objects>
6765
<viewController id="TPi-eh-Uqf" customClass="DetailViewController" customModule="KeyCommand" customModuleProvider="target" sceneMemberID="viewController">
6866
<view key="view" contentMode="scaleToFill" id="g4V-cs-OEu">
69-
<rect key="frame" x="0.0" y="0.0" width="540" height="620"/>
67+
<rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
7068
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
7169
<subviews>
7270
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0UB-rC-I2j">
73-
<rect key="frame" x="250.5" y="287" width="39" height="46"/>
71+
<rect key="frame" x="168" y="300.5" width="39" height="46"/>
7472
<fontDescription key="fontDescription" type="system" pointSize="28"/>
7573
<state key="normal" title="OK"/>
7674
<connections>
@@ -89,15 +87,15 @@
8987
</viewController>
9088
<placeholder placeholderIdentifier="IBFirstResponder" id="84U-dg-7e6" userLabel="First Responder" sceneMemberID="firstResponder"/>
9189
</objects>
92-
<point key="canvasLocation" x="2235.15625" y="56.835937499999993"/>
90+
<point key="canvasLocation" x="2191" y="36"/>
9391
</scene>
9492
<!--Navigation Controller-->
9593
<scene sceneID="nNt-bf-kpQ">
9694
<objects>
9795
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="8Gs-Ir-fuX" sceneMemberID="viewController">
9896
<toolbarItems/>
9997
<navigationBar key="navigationBar" contentMode="scaleToFill" id="hcS-gH-eJc">
100-
<rect key="frame" x="0.0" y="20" width="768" height="44"/>
98+
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
10199
<autoresizingMask key="autoresizingMask"/>
102100
</navigationBar>
103101
<nil name="viewControllers"/>
@@ -107,15 +105,15 @@
107105
</navigationController>
108106
<placeholder placeholderIdentifier="IBFirstResponder" id="qaJ-nu-37L" userLabel="First Responder" sceneMemberID="firstResponder"/>
109107
</objects>
110-
<point key="canvasLocation" x="77" y="111"/>
108+
<point key="canvasLocation" x="-31" y="38"/>
111109
</scene>
112110
<!--Navigation Controller-->
113111
<scene sceneID="TLC-UX-tMD">
114112
<objects>
115113
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="T1l-Fx-ZsT" sceneMemberID="viewController">
116114
<toolbarItems/>
117115
<navigationBar key="navigationBar" contentMode="scaleToFill" id="fDu-mz-DDh">
118-
<rect key="frame" x="0.0" y="0.0" width="540" height="44"/>
116+
<rect key="frame" x="0.0" y="0.0" width="375" height="56"/>
119117
<autoresizingMask key="autoresizingMask"/>
120118
</navigationBar>
121119
<nil name="viewControllers"/>
@@ -125,7 +123,7 @@
125123
</navigationController>
126124
<placeholder placeholderIdentifier="IBFirstResponder" id="J7c-f7-DDj" userLabel="First Responder" sceneMemberID="firstResponder"/>
127125
</objects>
128-
<point key="canvasLocation" x="1469.53125" y="56.835937499999993"/>
126+
<point key="canvasLocation" x="1497" y="36"/>
129127
</scene>
130128
</scenes>
131129
<inferredMetricsTieBreakers>

KeyCommand/KeyCommand/DetailViewController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import UIKit
3535

3636
class DetailViewController: UIViewController {
37-
3837
var priority = UYLPriority.none {
3938
didSet {
4039
configureView()
@@ -43,7 +42,7 @@ class DetailViewController: UIViewController {
4342

4443
override var keyCommands: [UIKeyCommand]? {
4544
return [
46-
UIKeyCommand(input: UIKeyInputEscape,
45+
UIKeyCommand(input: UIKeyCommand.inputEscape,
4746
modifierFlags: [],
4847
action: #selector(DetailViewController.dismissAction),
4948
discoverabilityTitle: NSLocalizedString("CloseWindow", comment: "Close window"))

KeyCommand/KeyCommand/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>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
2121
<key>LSRequiresIPhoneOS</key>

KeyCommand/KeyCommand/OptionViewController.swift

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import UIKit
3535

3636
class OptionViewController: UIViewController {
37-
3837
private enum InputKey: String {
3938
case low = "1"
4039
case medium = "2"
@@ -46,20 +45,20 @@ class OptionViewController: UIViewController {
4645

4746
override var keyCommands: [UIKeyCommand]? {
4847
return [
49-
UIKeyCommand(input: InputKey.low.rawValue,
50-
modifierFlags: .command,
51-
action: #selector(OptionViewController.performCommand(sender:)),
52-
discoverabilityTitle: NSLocalizedString("LowPriority", comment: "Low priority")),
48+
UIKeyCommand(input: InputKey.low.rawValue,
49+
modifierFlags: .command,
50+
action: #selector(OptionViewController.performCommand(sender:)),
51+
discoverabilityTitle: NSLocalizedString("LowPriority", comment: "Low priority")),
5352

54-
UIKeyCommand(input: InputKey.medium.rawValue,
55-
modifierFlags: .command,
56-
action: #selector(OptionViewController.performCommand(sender:)),
57-
discoverabilityTitle: NSLocalizedString("MediumPriority", comment: "Medium priority")),
53+
UIKeyCommand(input: InputKey.medium.rawValue,
54+
modifierFlags: .command,
55+
action: #selector(OptionViewController.performCommand(sender:)),
56+
discoverabilityTitle: NSLocalizedString("MediumPriority", comment: "Medium priority")),
5857

59-
UIKeyCommand(input: InputKey.high.rawValue,
60-
modifierFlags: .command,
61-
action: #selector(OptionViewController.performCommand(sender:)),
62-
discoverabilityTitle: NSLocalizedString("HighPriority", comment: "High priority"))
58+
UIKeyCommand(input: InputKey.high.rawValue,
59+
modifierFlags: .command,
60+
action: #selector(OptionViewController.performCommand(sender:)),
61+
discoverabilityTitle: NSLocalizedString("HighPriority", comment: "High priority"))
6362
]
6463
}
6564

@@ -74,9 +73,9 @@ class OptionViewController: UIViewController {
7473
}
7574
}
7675

77-
// You can also add key commands without overriding the
78-
// keyCommands property. For example you could call the
79-
// following function from viewDidLoad:
76+
// You can also add key commands without overriding the
77+
// keyCommands property. For example you could call the
78+
// following function from viewDidLoad:
8079

8180
// private func setupCommands() {
8281
// let lowCommand = UIKeyCommand(input: InputKey.low.rawValue,
@@ -100,15 +99,13 @@ class OptionViewController: UIViewController {
10099
}
101100

102101
extension OptionViewController: SegueHandlerType {
103-
104102
enum SegueIdentifier: String {
105103
case low
106104
case medium
107105
case high
108106
}
109107

110108
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
111-
112109
guard let navController = segue.destination as? UINavigationController,
113110
let viewController = navController.topViewController as? DetailViewController else {
114111
fatalError("Expected embedded DetailViewController")

KeyCommand/KeyCommand/SegueHandlerType.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ protocol SegueHandlerType {
3737
}
3838

3939
extension SegueHandlerType where Self: UIViewController, SegueIdentifier.RawValue == String {
40-
4140
func performSegue(withIdentifier segueIdentifier: SegueIdentifier, sender: AnyObject?) {
42-
performSegue(withIdentifier: segueIdentifier.rawValue, sender:sender)
41+
performSegue(withIdentifier: segueIdentifier.rawValue, sender: sender)
4342
}
4443

4544
func segueIdentifierForSegue(segue: UIStoryboardSegue) -> SegueIdentifier {
4645
guard let identifier = segue.identifier,
4746
let segueIdentifier = SegueIdentifier(rawValue: identifier) else {
48-
fatalError("Unknown Segue Identifier \(segue.identifier ?? "Missing")")
47+
fatalError("Unknown Segue Identifier \(segue.identifier ?? "Missing")")
4948
}
5049
return segueIdentifier
5150
}

0 commit comments

Comments
 (0)