Skip to content

ChristopherCarranza/UnboxedAlamofire

 
 

Repository files navigation

UnboxedAlamofire

Build Status CocoaPods Compatible Carthage Compatible Platform

Alamofire + Unbox: the easiest way to download and decode JSON into swift objects.

Features

  • Unit tested
  • Fully documented
  • Mapping response to objects
  • Mapping response to array of objects
  • Keypaths
  • Nested keypaths
  • For Swift 2.x use v. 1.x and swift2 branch
  • For Swift 3.x use v. 2.x

Usage

Objects you request have to conform Unboxable protocol.

Get an object

Alamofire.request(url, method: .get).responseObject { (response: DataResponse<Candy>) in
	let candy = response.result.value
}

Get an array

Alamofire.request(url, method: .get).responseArray { (response: DataResponse<[Candy]>) in
	let candies = response.result.value
}

KeyPath

Also you can specify a keypath in both requests:

Alamofire.request(url, method: .get).responseObject(keyPath: "response") { (response: DataResponse<Candy>) in
	let candy = response.result.value
}

Installation

pod 'UnboxedAlamofire', '~> 2.0'
github "serejahh/UnboxedAlamofire" ~> 2.0

About

Alamofire + Unbox: the easiest way to download and decode JSON into swift objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.2%
  • Ruby 5.0%
  • Objective-C 3.8%