diff --git a/Examples/Swift Example/SwiftExample/AppDelegate.swift b/Examples/Swift Example/SwiftExample/AppDelegate.swift old mode 100644 new mode 100755 index b7393689dc..af1267136a --- a/Examples/Swift Example/SwiftExample/AppDelegate.swift +++ b/Examples/Swift Example/SwiftExample/AppDelegate.swift @@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> 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/Examples/Swift Example/SwiftExample/Base.lproj/Main.storyboard b/Examples/Swift Example/SwiftExample/Base.lproj/Main.storyboard old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/Swift Example/SwiftExample/Images.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/LaunchImage.launchimage/Contents.json b/Examples/Swift Example/SwiftExample/Images.xcassets/LaunchImage.launchimage/Contents.json old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/background.imageset/Contents.json b/Examples/Swift Example/SwiftExample/Images.xcassets/background.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/background.imageset/background.png b/Examples/Swift Example/SwiftExample/Images.xcassets/background.imageset/background.png old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/page.imageset/Contents.json b/Examples/Swift Example/SwiftExample/Images.xcassets/page.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Images.xcassets/page.imageset/page.png b/Examples/Swift Example/SwiftExample/Images.xcassets/page.imageset/page.png old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/Info.plist b/Examples/Swift Example/SwiftExample/Info.plist old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/SwiftExample-Bridging-Header.h b/Examples/Swift Example/SwiftExample/SwiftExample-Bridging-Header.h old mode 100644 new mode 100755 diff --git a/Examples/Swift Example/SwiftExample/ViewController.swift b/Examples/Swift Example/SwiftExample/ViewController.swift old mode 100644 new mode 100755 index d8c1489b60..7f0e48e27c --- a/Examples/Swift Example/SwiftExample/ViewController.swift +++ b/Examples/Swift Example/SwiftExample/ViewController.swift @@ -33,31 +33,32 @@ class ViewController: UIViewController, iCarouselDataSource, iCarouselDelegate return items.count } - func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, var reusingView view: UIView!) -> UIView! + func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! { var label: UILabel! = nil + var newView = view //create new view if no view is available for recycling - if (view == nil) + if (newView == nil) { //don't do anything specific to the index within //this `if (view == nil) {...}` statement because the view will be //recycled and used with other index values later - view = UIImageView(frame:CGRectMake(0, 0, 200, 200)) - (view as UIImageView!).image = UIImage(named: "page.png") - view.contentMode = .Center + newView = UIImageView(frame:CGRectMake(0, 0, 200, 200)) + (newView as! UIImageView).image = UIImage(named: "page.png") + newView.contentMode = .Center - label = UILabel(frame:view.bounds) + label = UILabel(frame:newView.bounds) label.backgroundColor = UIColor.clearColor() label.textAlignment = .Center label.font = label.font.fontWithSize(50) label.tag = 1 - view.addSubview(label) + newView.addSubview(label) } else { //get a reference to the label in the recycled view - label = view.viewWithTag(1) as UILabel! + label = newView.viewWithTag(1) as! UILabel } //set item label @@ -67,7 +68,7 @@ class ViewController: UIViewController, iCarouselDataSource, iCarouselDelegate //in the wrong place in the carousel label.text = "\(items[index])" - return view + return newView } func carousel(carousel: iCarousel!, valueForOption option: iCarouselOption, withDefault value: CGFloat) -> CGFloat