Skip to content

Commit 90c53c6

Browse files
committed
Convert example app code to Swift 3 syntax
1 parent 1e730f6 commit 90c53c6

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

ManualLayout.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,11 @@
360360
TargetAttributes = {
361361
5F91347C1AC9E1630001DBF8 = {
362362
CreatedOnToolsVersion = 6.2;
363+
LastSwiftMigration = 0800;
363364
};
364365
5F9134901AC9E1640001DBF8 = {
365366
CreatedOnToolsVersion = 6.2;
367+
LastSwiftMigration = 0800;
366368
TestTargetID = 5F91347C1AC9E1630001DBF8;
367369
};
368370
5FB4CBE81A9BBE7500C2FB4F = {
@@ -539,6 +541,7 @@
539541
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
540542
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
541543
PRODUCT_NAME = "$(TARGET_NAME)";
544+
SWIFT_VERSION = 3.0;
542545
};
543546
name = Debug;
544547
};
@@ -552,6 +555,7 @@
552555
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
553556
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
554557
PRODUCT_NAME = "$(TARGET_NAME)";
558+
SWIFT_VERSION = 3.0;
555559
};
556560
name = Release;
557561
};
@@ -572,6 +576,7 @@
572576
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
573577
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
574578
PRODUCT_NAME = "$(TARGET_NAME)";
579+
SWIFT_VERSION = 3.0;
575580
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleExample.app/SimpleExample";
576581
};
577582
name = Debug;
@@ -590,6 +595,7 @@
590595
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
591596
PRODUCT_BUNDLE_IDENTIFIER = "com.bsencan.ManualLayout.SimpleExample.$(PRODUCT_NAME:rfc1034identifier)";
592597
PRODUCT_NAME = "$(TARGET_NAME)";
598+
SWIFT_VERSION = 3.0;
593599
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SimpleExample.app/SimpleExample";
594600
};
595601
name = Release;

SimpleExample/AppDelegate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import UIKit
1212
class AppDelegate: UIResponder, UIApplicationDelegate {
1313
var window: UIWindow?
1414

15-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
16-
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
17-
window.backgroundColor = UIColor.whiteColor()
15+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
16+
let window = UIWindow(frame: UIScreen.main.bounds)
17+
window.backgroundColor = UIColor.white
1818
window.rootViewController = ExampleViewController()
1919
window.makeKeyAndVisible()
2020
self.window = window

SimpleExample/ExampleViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ internal final class ExampleViewController: UIViewController {
2222
subtitleLabel.attributedText = NSAttributedString(
2323
string: "Lorem ipsum dolor sit amet, pro eu epicurei oportere similique, everti postulant repudiandae ei nam.",
2424
attributes: generateTextStyle(smaller: true))
25-
subtitleLabel.textAlignment = .Center
25+
subtitleLabel.textAlignment = .center
2626
subtitleLabel.numberOfLines = 3
27-
yinView.backgroundColor = UIColor.blackColor()
27+
yinView.backgroundColor = UIColor.black
2828
}
2929

3030
required init(coder aDecoder: NSCoder) {
@@ -33,7 +33,7 @@ internal final class ExampleViewController: UIViewController {
3333

3434
override func viewDidLoad() {
3535
super.viewDidLoad()
36-
view.backgroundColor = UIColor.whiteColor()
36+
view.backgroundColor = UIColor.white
3737
view.addSubview(titleLabel)
3838
view.addSubview(subtitleLabel)
3939
view.addSubview(yinView)
@@ -51,10 +51,10 @@ internal final class ExampleViewController: UIViewController {
5151
yinView.bottom2 = bottom
5252
}
5353

54-
private func generateTextStyle(smaller smaller: Bool = false) -> [String: AnyObject] {
54+
fileprivate func generateTextStyle(smaller: Bool = false) -> [String: AnyObject] {
5555
return [
56-
NSFontAttributeName: UIFont.systemFontOfSize(smaller ? 14 : 18),
57-
NSForegroundColorAttributeName: UIColor.blackColor()
56+
NSFontAttributeName: UIFont.systemFont(ofSize: smaller ? 14 : 18),
57+
NSForegroundColorAttributeName: UIColor.black
5858
]
5959
}
6060
}

SimpleExample/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1.1</string>
18+
<string>1.2.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>3</string>
22+
<string>4</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UILaunchStoryboardName</key>

SimpleExampleTests/SimpleExampleTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SimpleExampleTests: XCTestCase {
2828

2929
func testPerformanceExample() {
3030
// This is an example of a performance test case.
31-
self.measureBlock() {
31+
self.measure() {
3232
// Put the code you want to measure the time of here.
3333
}
3434
}

0 commit comments

Comments
 (0)