Skip to content

Commit 0098341

Browse files
committed
updated for Swift 1.2
1 parent 639640d commit 0098341

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

IOS8SwiftJSONTutorial/IOS8SwiftJSONTutorial/AppDelegate.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ import UIKit
1212
class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
15-
16-
17-
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
18-
// Override point for customization after application launch.
19-
return true
15+
16+
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
17+
// Override point for customization after application launch.
18+
return true
2019
}
2120

22-
func applicationWillResignActive(application: UIApplication!) {
21+
func applicationWillResignActive(application: UIApplication) {
2322
// 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.
2423
// 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.
2524
}
25+
2626

27-
func applicationDidEnterBackground(application: UIApplication!) {
27+
func applicationDidEnterBackground(application: UIApplication) {
2828
// 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.
2929
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
3030
}
3131

32-
func applicationWillEnterForeground(application: UIApplication!) {
32+
func applicationWillEnterForeground(application: UIApplication) {
3333
// 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.
3434
}
3535

36-
func applicationDidBecomeActive(application: UIApplication!) {
36+
func applicationDidBecomeActive(application: UIApplication) {
3737
// 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.
3838
}
3939

40-
func applicationWillTerminate(application: UIApplication!) {
40+
func applicationWillTerminate(application: UIApplication) {
4141
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4242
}
4343

IOS8SwiftJSONTutorial/IOS8SwiftJSONTutorial/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ class ViewController: UIViewController {
2828
var err: NSError?
2929

3030
// 3
31-
var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as NSDictionary
31+
var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as! NSDictionary
3232
if (err != nil) {
3333
println("JSON Error \(err!.localizedDescription)")
3434
}
3535

3636
// 4
37-
let jsonDate: String! = jsonResult["date"] as NSString
38-
let jsonTime: String! = jsonResult["time"] as NSString
37+
let jsonDate: String! = jsonResult["date"] as! String
38+
let jsonTime: String! = jsonResult["time"] as! String
3939

4040
dispatch_async(dispatch_get_main_queue(), {
4141
self.dateLabel.text = jsonDate

0 commit comments

Comments
 (0)