From b8ba2c77e1e5d6f43037b7f4d95f680e33d3bf08 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 15 Jan 2019 20:52:38 -0800 Subject: [PATCH 1/3] Updated project for Swift 4.2. --- ToDoList.xcodeproj/project.pbxproj | 5 +++ .../contents.xcworkspacedata | 0 .../xcschemes/ToDoList.xcscheme | 0 .../xcschemes/xcschememanagement.plist | 0 ToDoList/AddToDoItemViewController.swift | 24 +++++++------- ToDoList/AppDelegate.swift | 20 ++++++----- ToDoList/Base.lproj/LaunchScreen.xib | 0 ToDoList/Base.lproj/Main.storyboard | 33 +++++++++++-------- .../AppIcon.appiconset/Contents.json | 0 ToDoList/Info.plist | 0 ToDoList/StateController.swift | 6 ++-- ToDoList/TableViewDataSource.swift | 8 ++--- ToDoList/TableViewDelegate.swift | 8 ++--- ToDoList/ToDoItem.swift | 17 +++++----- ToDoList/ToDoItemCell.swift | 4 +-- ToDoList/ToDoListTableViewController.swift | 12 +++---- ToDoListTests/Info.plist | 0 ToDoListTests/ToDoListTests.swift | 0 18 files changed, 76 insertions(+), 61 deletions(-) mode change 100644 => 100755 ToDoList.xcodeproj/project.pbxproj mode change 100644 => 100755 ToDoList.xcodeproj/project.xcworkspace/contents.xcworkspacedata mode change 100644 => 100755 ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/ToDoList.xcscheme mode change 100644 => 100755 ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/xcschememanagement.plist mode change 100644 => 100755 ToDoList/AddToDoItemViewController.swift mode change 100644 => 100755 ToDoList/AppDelegate.swift mode change 100644 => 100755 ToDoList/Base.lproj/LaunchScreen.xib mode change 100644 => 100755 ToDoList/Base.lproj/Main.storyboard mode change 100644 => 100755 ToDoList/Images.xcassets/AppIcon.appiconset/Contents.json mode change 100644 => 100755 ToDoList/Info.plist mode change 100644 => 100755 ToDoList/StateController.swift mode change 100644 => 100755 ToDoList/TableViewDataSource.swift mode change 100644 => 100755 ToDoList/TableViewDelegate.swift mode change 100644 => 100755 ToDoList/ToDoItem.swift mode change 100644 => 100755 ToDoList/ToDoItemCell.swift mode change 100644 => 100755 ToDoList/ToDoListTableViewController.swift mode change 100644 => 100755 ToDoListTests/Info.plist mode change 100644 => 100755 ToDoListTests/ToDoListTests.swift diff --git a/ToDoList.xcodeproj/project.pbxproj b/ToDoList.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 2c5db07..4d87c49 --- a/ToDoList.xcodeproj/project.pbxproj +++ b/ToDoList.xcodeproj/project.pbxproj @@ -181,6 +181,7 @@ TargetAttributes = { 954D24811B7A2DDA00DD9E4E = { CreatedOnToolsVersion = 6.4; + DevelopmentTeam = TXV64D6H4A; }; 954D24961B7A2DDA00DD9E4E = { CreatedOnToolsVersion = 6.4; @@ -367,10 +368,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = TXV64D6H4A; INFOPLIST_FILE = ToDoList/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.purecreek.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -378,10 +381,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = TXV64D6H4A; INFOPLIST_FILE = ToDoList/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.purecreek.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/ToDoList.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ToDoList.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/ToDoList.xcscheme b/ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/ToDoList.xcscheme old mode 100644 new mode 100755 diff --git a/ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/xcschememanagement.plist b/ToDoList.xcodeproj/xcuserdata/matteo.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git a/ToDoList/AddToDoItemViewController.swift b/ToDoList/AddToDoItemViewController.swift old mode 100644 new mode 100755 index 7135444..8b24afe --- a/ToDoList/AddToDoItemViewController.swift +++ b/ToDoList/AddToDoItemViewController.swift @@ -14,16 +14,16 @@ class AddToDoItemViewController: UIViewController { @IBOutlet weak var nameTextField: UITextField! var stateController: StateController? - - override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { - guard let tappedButton = sender as? UIBarButtonItem where tappedButton != cancelButton else { - return; - } - guard let text = nameTextField.text else { - return - } - let todoItem = ToDoItem(name: text, completed: false, creationDate: NSDate()) - stateController?.addItem(todoItem) - } - + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + guard let tappedButton = sender as? UIBarButtonItem, tappedButton != cancelButton else { + return; + } + guard let text = nameTextField.text else { + return + } + let todoItem = ToDoItem(name: text, completed: false, creationDate: NSDate()) + stateController?.addItem(item: todoItem) + } + } diff --git a/ToDoList/AppDelegate.swift b/ToDoList/AppDelegate.swift old mode 100644 new mode 100755 index a8fc973..123692f --- a/ToDoList/AppDelegate.swift +++ b/ToDoList/AppDelegate.swift @@ -14,19 +14,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let stateController = StateController() - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - if let navigationController = window?.rootViewController as? UINavigationController, - let toDoListTableViewController = navigationController.viewControllers.first as? ToDoListTableViewController { - toDoListTableViewController.stateController = stateController - } - return true - } + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool + { + if let navigationController = window?.rootViewController as? UINavigationController, + let toDoListTableViewController = navigationController.viewControllers.first as? ToDoListTableViewController { + toDoListTableViewController.stateController = stateController + } + return true + } - func applicationWillTerminate(application: UIApplication) { + func applicationWillTerminate(_ application: UIApplication) { stateController.save() } - func applicationWillResignActive(application: UIApplication) { + func applicationWillResignActive(_ application: UIApplication) { stateController.save() } } diff --git a/ToDoList/Base.lproj/LaunchScreen.xib b/ToDoList/Base.lproj/LaunchScreen.xib old mode 100644 new mode 100755 diff --git a/ToDoList/Base.lproj/Main.storyboard b/ToDoList/Base.lproj/Main.storyboard old mode 100644 new mode 100755 index 412879e..6409ce8 --- a/ToDoList/Base.lproj/Main.storyboard +++ b/ToDoList/Base.lproj/Main.storyboard @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -10,7 +14,7 @@ - + @@ -26,16 +30,19 @@ - + - + + +