Skip to content

Commit ba4822b

Browse files
committed
Upgraded Example app to Swift 5.
1 parent 2dec32b commit ba4822b

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

Example/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import UIKit
1212
class AppDelegate: UIResponder, UIApplicationDelegate {
1313
var window: UIWindow?
1414

15-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
15+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1616
self.window = {
1717
let window = UIWindow(frame: UIScreen.main.bounds)
1818
window.backgroundColor = .white

Example/ImageAttachmentView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ImageAttachmentView: UIView, ImageThumbnailViewDelegate {
2121

2222
override init(frame: CGRect) {
2323
attachButton = UIButton(type: .custom)
24-
attachButton.setBackgroundImage(UIImage(named: "attach-button")!, for: UIControlState())
24+
attachButton.setBackgroundImage(UIImage(named: "attach-button")!, for: UIControl.State())
2525
attachButton.adjustsImageWhenHighlighted = true
2626

2727
let stackView = UIStackView(frame: CGRect.zero)

Example/ImageAttachmentViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ class ImageAttachmentViewController: UIViewController, UIImagePickerControllerDe
3838
}
3939

4040
// MARK: UIImagePickerControllerDelegate
41-
42-
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
41+
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
4342
dismiss(animated: true, completion: nil)
44-
guard let imageURL = info[UIImagePickerControllerReferenceURL] as? URL else { return }
43+
guard let imageURL = info[.referenceURL] as? URL else { return }
4544
getImageThumbnail(imageURL) { image in
4645
if let image = image {
4746
self.attachmentView?.addImageWithThumbnail(image)

Example/ImageThumbnailView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ open class ImageThumbnailView: UIView {
2626
let deleteButtonImage = UIImage(named: "delete-button")!
2727
let deleteButton = UIButton(type: .custom)
2828
deleteButton.translatesAutoresizingMaskIntoConstraints = false
29-
deleteButton.setBackgroundImage(deleteButtonImage, for: UIControlState())
29+
deleteButton.setBackgroundImage(deleteButtonImage, for: UIControl.State())
3030
deleteButton.addTarget(self, action: #selector(ImageThumbnailView.didTapDelete(_:)), for: .touchUpInside)
3131

3232
let imageView = UIImageView(image: thumbnail)

Example/LabeledTextField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LabeledTextField: UIView {
1313
fileprivate struct Appearance {
1414
static let LabelTextColor = UIColor(white: 0.56, alpha: 1.0)
1515
static let FieldTextColor = UIColor.black
16-
static let Font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
16+
static let Font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
1717
}
1818

1919
fileprivate struct Layout {

Example/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ViewController: UIViewController {
4747
stackViewController.addItem(LabeledTextFieldController(labelText: "Subject:"))
4848

4949
let textView = UITextView(frame: CGRect.zero)
50-
textView.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.body)
50+
textView.font = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
5151
textView.isScrollEnabled = false
5252
textView.textContainerInset = UIEdgeInsets(top: 15, left: 10, bottom: 0, right: 10)
5353
textView.text = "This field automatically expands as you type, no additional logic required"
@@ -58,10 +58,10 @@ class ViewController: UIViewController {
5858
}
5959

6060
fileprivate func displayStackViewController() {
61-
addChildViewController(stackViewController)
61+
addChild(stackViewController)
6262
view.addSubview(stackViewController.view)
6363
_ = stackViewController.view.activateSuperviewHuggingConstraints()
64-
stackViewController.didMove(toParentViewController: self)
64+
stackViewController.didMove(toParent: self)
6565
}
6666

6767
override func viewDidAppear(_ animated: Bool) {

StackViewController.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
};
272272
72D1940A1CC357A100645F83 = {
273273
CreatedOnToolsVersion = 7.3;
274-
LastSwiftMigration = 0900;
274+
LastSwiftMigration = 1110;
275275
};
276276
};
277277
};
@@ -572,7 +572,7 @@
572572
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
573573
PRODUCT_BUNDLE_IDENTIFIER = co.seed.Example;
574574
PRODUCT_NAME = "$(TARGET_NAME)";
575-
SWIFT_VERSION = 4.0;
575+
SWIFT_VERSION = 5.0;
576576
};
577577
name = Debug;
578578
};
@@ -585,7 +585,7 @@
585585
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
586586
PRODUCT_BUNDLE_IDENTIFIER = co.seed.Example;
587587
PRODUCT_NAME = "$(TARGET_NAME)";
588-
SWIFT_VERSION = 4.0;
588+
SWIFT_VERSION = 5.0;
589589
};
590590
name = Release;
591591
};

0 commit comments

Comments
 (0)