From 8d03c121c4c719a951de0b8137d5d218f30b08d5 Mon Sep 17 00:00:00 2001 From: Alexander Schuch Date: Tue, 24 Mar 2015 11:37:12 +0100 Subject: [PATCH] support swift 1.2 in demo project --- Example.xcodeproj/project.pbxproj | 8 ++++---- Example/AppDelegate.swift | 19 +++++++++---------- Example/ViewController.swift | 6 +++--- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Example.xcodeproj/project.pbxproj b/Example.xcodeproj/project.pbxproj index 220229b..d3c9348 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/Example.xcodeproj/project.pbxproj @@ -425,7 +425,7 @@ ); INFOPLIST_FILE = StatefulViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -448,7 +448,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = StatefulViewController/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -470,7 +470,7 @@ "$(inherited)", ); INFOPLIST_FILE = StatefulViewControllerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; @@ -486,7 +486,7 @@ "$(inherited)", ); INFOPLIST_FILE = StatefulViewControllerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index 4cd5f47..d6aa18d 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -13,31 +13,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } - func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { - // Override point for customization after application launch. - return true - } - - func applicationWillResignActive(application: UIApplication!) { + func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - func applicationDidEnterBackground(application: UIApplication!) { + func applicationDidEnterBackground(application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(application: UIApplication!) { + func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(application: UIApplication!) { + func applicationDidBecomeActive(application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - func applicationWillTerminate(application: UIApplication!) { + func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } diff --git a/Example/ViewController.swift b/Example/ViewController.swift index f74d520..9a78013 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -66,7 +66,7 @@ class ViewController: StatefulViewController { extension ViewController: StatefulViewControllerDelegate { func hasContent() -> Bool { - return countElements(dataArray) > 0 + return count(dataArray) > 0 } func handleErrorWhenContentAvailable(error: NSError) { @@ -79,11 +79,11 @@ extension ViewController: StatefulViewControllerDelegate { extension ViewController: UITableViewDataSource { func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return countElements(dataArray) + return count(dataArray) } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCellWithIdentifier("textCell", forIndexPath: indexPath) as UITableViewCell + let cell = tableView.dequeueReusableCellWithIdentifier("textCell", forIndexPath: indexPath) as! UITableViewCell cell.textLabel?.text = dataArray[indexPath.row] return cell }