Skip to content

Migrate to Swift 5 and iOS 13 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CoordinatorExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -312,7 +313,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.townsend.CoordinatorExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -325,7 +326,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.townsend.CoordinatorExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -348,6 +349,7 @@
BEEE17D61DD5CB2A004D6FCE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
1 change: 1 addition & 0 deletions CoordinatorExample/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extension AppCoordinator: SplashViewControllerDelegate {

let newOrderCoordinator = NewOrderCoordinator(with: self.services)
newOrderCoordinator.delegate = self
newOrderCoordinator.rootViewController.modalPresentationStyle = .fullScreen
newOrderCoordinator.start()
self.addChildCoordinator(newOrderCoordinator)
self.rootViewController.present(newOrderCoordinator.rootViewController, animated: true, completion: nil)
Expand Down
2 changes: 1 addition & 1 deletion CoordinatorExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var appCoordinator: AppCoordinator!

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

self.window = UIWindow(frame: UIScreen.main.bounds)
self.appCoordinator = AppCoordinator(window: self.window!, services: Services())
Expand Down
4 changes: 2 additions & 2 deletions CoordinatorExample/Coordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public protocol Coordinator: class {
public extension Coordinator {

/// Add a child coordinator to the parent
public func addChildCoordinator(_ childCoordinator: Coordinator) {
func addChildCoordinator(_ childCoordinator: Coordinator) {
self.childCoordinators.append(childCoordinator)
}

/// Remove a child coordinator from the parent
public func removeChildCoordinator(_ childCoordinator: Coordinator) {
func removeChildCoordinator(_ childCoordinator: Coordinator) {
self.childCoordinators = self.childCoordinators.filter { $0 !== childCoordinator }
}

Expand Down
2 changes: 1 addition & 1 deletion CoordinatorExample/DrinkTypeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class DrinkTypeViewController: UITableViewController {

let drinkType = self.drinkTypes[indexPath.row]

let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: nil)
let cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: nil)
cell.textLabel?.text = drinkType
return cell
}
Expand Down
2 changes: 1 addition & 1 deletion CoordinatorExample/SnackTypeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SnackTypeViewController: UITableViewController {

let snackType = self.snackTypes[indexPath.row]

let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: nil)
let cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: nil)
cell.textLabel?.text = snackType
return cell
}
Expand Down
14 changes: 7 additions & 7 deletions CoordinatorExample/SplashViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class SplashViewController: UIViewController {
let newOrderButton = UIButton(type: .system)
newOrderButton.setTitle("New order", for: .normal)
newOrderButton.backgroundColor = .red
newOrderButton.addTarget(self, action: #selector(didTapNewOrder), for: UIControlEvents.touchUpInside)
newOrderButton.addTarget(self, action: #selector(didTapNewOrder), for: UIControl.Event.touchUpInside)

self.view.addSubview(newOrderButton)

Expand Down Expand Up @@ -71,15 +71,15 @@ public class SplashViewController: UIViewController {
paragraphStyle.lineSpacing = 20

let fontAttributes = [
NSForegroundColorAttributeName: UIColor.black,
NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName: UIFont.systemFont(ofSize: 40)
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 40)
]

let largeFontAttributes = [
NSForegroundColorAttributeName: UIColor.black,
NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName: UIFont.boldSystemFont(ofSize: 70)
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 70)
]

let string = NSMutableAttributedString()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the project to accompany my [blog post on the Coordinator Pattern](https

## 📍 Getting Started

> As of 11th November 2016, this project requires [Xcode 8.0](https://developer.apple.com/xcode/downloads/) (Swift 3.0)
> As of 18th of November 2019, this project requires [Xcode 11.0](https://developer.apple.com/xcode/downloads/) (Swift 5.0)

The following commands will download the repository, and open the desired Xcode project.

Expand Down