16. Cocoapods : exemple
platform :ios, '8.0'
pod 'Alamofire'
pod 'MaterialKit'
pod 'Toucan'
pod 'SwiftyJSON'
pod 'SwiftyUserDefaults'
pod 'KeychainSwift'
pod 'JLToast'
pod 'Spring'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
17. Cocoapods : exemple
platform :ios, '8.0'
pod 'Alamofire'
pod 'MaterialKit'
pod 'Toucan'
pod 'SwiftyJSON'
pod 'SwiftyUserDefaults'
pod 'KeychainSwift'
pod 'JLToast'
pod 'Spring'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
18. Cocoapods : exemple
use_frameworks!
platform :ios, '8.0'
pod 'Alamofire'
pod 'MaterialKit'
pod 'Toucan'
pod 'SwiftyJSON'
pod 'SwiftyUserDefaults'
pod 'KeychainSwift'
pod 'JLToast'
pod 'Spring'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.10'
19. Cocoapods : exemple
$ pod install
App.xcodeproj -> App.xcworkspace
$ open App.xcworkspace
22. SwiftyJSON - Avant
let jsonObject : AnyObject! =
NSJSONSerialization.JSONObjectWithData(dataFromTwitter, options:
NSJSONReadingOptions.MutableContainers, error: nil)
if let statusesArray = jsonObject as? NSArray{
if let aStatus = statusesArray[0] as? NSDictionary{
if let user = aStatus["user"] as? NSDictionary{
if let userName = user["name"] as? NSDictionary{
//Finally We Got The Name
}
}
}
}
23. SwiftyJSON - Avant
let jsonObject : AnyObject! =
NSJSONSerialization.JSONObjectWithData(dataFromTwitter, options:
NSJSONReadingOptions.MutableContainers, error: nil)
if let statusesArray = jsonObject as? NSArray{
if let aStatus = statusesArray[0] as? NSDictionary{
if let user = aStatus["user"] as? NSDictionary{
if let userName = user["name"] as? NSDictionary{
//Finally We Got The Name
}
}
}
}
24. SwiftyJSON - Après
let json = JSON(data: dataFromNetworking)
if let userName = json[0]["user"]["name"].string{
//Now you got your value
}
45. Plus d’information
Swift Language Documentation
http://developer.apple.com/swift
Apple Developer Forums
http://developer.apple.com/forums
Quentin de Quelen
Swift Evangelist
quentin@dequelen.me