Alamofire + Unbox: the easiest way to download and decode JSON into swift objects.
- Unit tested
- Fully documented
- Mapping response to objects
- Mapping response to array of objects
- Keypaths
- Nested keypaths
Objects you request have to conform Unboxable protocol.
Alamofire.request(.GET, url).responseObject { (response: Response<Candy, NSError>) in
let candy = response.result.value
}
Alamofire.request(.GET, url).responseArray { (response: Response<[Candy], NSError>) in
let candies = response.result.value
}
Also you can specify a keypath in both requests:
Alamofire.request(.GET, url).responseObject(keyPath: "response") { (response: Response<Candy, NSError>) in
let candy = response.result.value
}
pod 'UnboxedAlamofire', '~> 1.0'
github "serejahh/UnboxedAlamofire" ~> 1.0