Skip to content

Commit c4d5539

Browse files
authored
Merge pull request #52 from seedco/dm-swift-5
Migrate to Swift 5
2 parents eda9b18 + 38cf35b commit c4d5539

21 files changed

+95
-89
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build-and-test:
44

55
macos:
6-
xcode: 9.3.1
6+
xcode: 11.1.0
77

88
steps:
99
- checkout

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# [Unreleased](https://github.com/seedco/StackViewController/compare/0.4.0...HEAD)
1+
# [0.5.0](https://github.com/seedco/StackViewController/compare/0.4.0...0.5.0)
22

3+
- Upgrade to Swift 5.0.
34
- Fix runtime crashes (unrecognized selector) by adding `@objc` annotation to public UIKit extensions.

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) {

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SDK="iphonesimulator"
2-
DESTINATION="platform=iOS Simulator,name=iPhone 6"
2+
DESTINATION="platform=iOS Simulator,name=iPhone 8"
33
PROJECT="StackViewController"
44
SCHEME="StackViewController"
55

SeedStackViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "SeedStackViewController"
33
s.module_name = "StackViewController"
4-
s.version = "0.4.0"
4+
s.version = "0.5.0"
55
s.summary = "Simplifies the process of building forms and other static content using UIStackView."
66
s.description = "StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIStackView."
77
s.homepage = "https://github.com/seedco/StackViewController"

0 commit comments

Comments
 (0)