Skip to content

Commit cbacdfb

Browse files
committed
Migrate to Swift 4.2
1 parent 1e3cffc commit cbacdfb

File tree

7 files changed

+39
-12
lines changed

7 files changed

+39
-12
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ xcuserdata
2323
*.xcuserstate
2424
*.xcscmblueprint
2525

26+
### Xcode Patch ###
27+
*.xcodeproj/*
28+
!*.xcodeproj/project.pbxproj
29+
!*.xcodeproj/xcshareddata/
30+
!*.xcworkspace/contents.xcworkspacedata
31+
/*.gcno
32+
2633
## Obj-C/Swift specific
2734
*.hmap
2835
*.ipa

ios-swift-collapsible-table-section.xcodeproj/project.pbxproj

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@
100100
isa = PBXProject;
101101
attributes = {
102102
LastSwiftUpdateCheck = 0730;
103-
LastUpgradeCheck = 0800;
103+
LastUpgradeCheck = 1010;
104104
ORGANIZATIONNAME = "Yong Su";
105105
TargetAttributes = {
106106
0A908DEA1CFCAA9200470F33 = {
107107
CreatedOnToolsVersion = 7.3.1;
108-
LastSwiftMigration = 0800;
108+
LastSwiftMigration = 1010;
109109
};
110110
};
111111
};
@@ -176,14 +176,22 @@
176176
CLANG_CXX_LIBRARY = "libc++";
177177
CLANG_ENABLE_MODULES = YES;
178178
CLANG_ENABLE_OBJC_ARC = YES;
179+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
179180
CLANG_WARN_BOOL_CONVERSION = YES;
181+
CLANG_WARN_COMMA = YES;
180182
CLANG_WARN_CONSTANT_CONVERSION = YES;
183+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
181184
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
182185
CLANG_WARN_EMPTY_BODY = YES;
183186
CLANG_WARN_ENUM_CONVERSION = YES;
184187
CLANG_WARN_INFINITE_RECURSION = YES;
185188
CLANG_WARN_INT_CONVERSION = YES;
189+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
190+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
191+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
186192
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
193+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
194+
CLANG_WARN_STRICT_PROTOTYPES = YES;
187195
CLANG_WARN_SUSPICIOUS_MOVE = YES;
188196
CLANG_WARN_UNREACHABLE_CODE = YES;
189197
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -211,7 +219,8 @@
211219
ONLY_ACTIVE_ARCH = YES;
212220
SDKROOT = iphoneos;
213221
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
214-
SWIFT_VERSION = 3.0;
222+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
223+
SWIFT_VERSION = 4.2;
215224
TARGETED_DEVICE_FAMILY = "1,2";
216225
};
217226
name = Debug;
@@ -225,14 +234,22 @@
225234
CLANG_CXX_LIBRARY = "libc++";
226235
CLANG_ENABLE_MODULES = YES;
227236
CLANG_ENABLE_OBJC_ARC = YES;
237+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
228238
CLANG_WARN_BOOL_CONVERSION = YES;
239+
CLANG_WARN_COMMA = YES;
229240
CLANG_WARN_CONSTANT_CONVERSION = YES;
241+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
230242
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
231243
CLANG_WARN_EMPTY_BODY = YES;
232244
CLANG_WARN_ENUM_CONVERSION = YES;
233245
CLANG_WARN_INFINITE_RECURSION = YES;
234246
CLANG_WARN_INT_CONVERSION = YES;
247+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
248+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
249+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
235250
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
251+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
252+
CLANG_WARN_STRICT_PROTOTYPES = YES;
236253
CLANG_WARN_SUSPICIOUS_MOVE = YES;
237254
CLANG_WARN_UNREACHABLE_CODE = YES;
238255
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -253,7 +270,8 @@
253270
MTL_ENABLE_DEBUG_INFO = NO;
254271
SDKROOT = iphoneos;
255272
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
256-
SWIFT_VERSION = 3.0;
273+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
274+
SWIFT_VERSION = 4.2;
257275
TARGETED_DEVICE_FAMILY = "1,2";
258276
VALIDATE_PRODUCT = YES;
259277
};
@@ -268,7 +286,8 @@
268286
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
269287
PRODUCT_BUNDLE_IDENTIFIER = "su.ios-swift-collapsible-table-section";
270288
PRODUCT_NAME = "$(TARGET_NAME)";
271-
SWIFT_VERSION = 3.0;
289+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
290+
SWIFT_VERSION = 4.2;
272291
};
273292
name = Debug;
274293
};
@@ -281,7 +300,8 @@
281300
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
282301
PRODUCT_BUNDLE_IDENTIFIER = "su.ios-swift-collapsible-table-section";
283302
PRODUCT_NAME = "$(TARGET_NAME)";
284-
SWIFT_VERSION = 3.0;
303+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
304+
SWIFT_VERSION = 4.2;
285305
};
286306
name = Release;
287307
};

ios-swift-collapsible-table-section/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818
// Override point for customization after application launch.
1919
self.window = UIWindow(frame:UIScreen.main.bounds)
2020
self.window?.makeKeyAndVisible()

ios-swift-collapsible-table-section/CollapsibleTableViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CollapsibleTableViewCell: UITableViewCell {
1414
let detailLabel = UILabel()
1515

1616
// MARK: Initalizers
17-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
17+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
1818
super.init(style: style, reuseIdentifier: reuseIdentifier)
1919

2020
let marginGuide = contentView.layoutMarginsGuide

ios-swift-collapsible-table-section/CollapsibleTableViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CollapsibleTableViewController: UITableViewController {
2020

2121
// Auto resizing the height of the cell
2222
tableView.estimatedRowHeight = 44.0
23-
tableView.rowHeight = UITableViewAutomaticDimension
23+
tableView.rowHeight = UITableView.automaticDimension
2424

2525
self.title = "Apple Products"
2626
}
@@ -54,7 +54,7 @@ extension CollapsibleTableViewController {
5454
}
5555

5656
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
57-
return UITableViewAutomaticDimension
57+
return UITableView.automaticDimension
5858
}
5959

6060
// Header

ios-swift-collapsible-table-section/CollapsibleTableViewHeader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CollapsibleTableViewHeader: UITableViewHeaderFooterView {
5959
//
6060
// Trigger toggle section when tapping on the header
6161
//
62-
func tapHeader(_ gestureRecognizer: UITapGestureRecognizer) {
62+
@objc func tapHeader(_ gestureRecognizer: UITapGestureRecognizer) {
6363
guard let cell = gestureRecognizer.view as? CollapsibleTableViewHeader else {
6464
return
6565
}

ios-swift-collapsible-table-section/Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension UIView {
2929
animation.toValue = toValue
3030
animation.duration = duration
3131
animation.isRemovedOnCompletion = false
32-
animation.fillMode = kCAFillModeForwards
32+
animation.fillMode = CAMediaTimingFillMode.forwards
3333

3434
self.layer.add(animation, forKey: nil)
3535
}

0 commit comments

Comments
 (0)