Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serejahh/UnboxedAlamofire
[Deprecated] Alamofire + Unbox: the easiest way to download and decode JSON into swift objects.
https://github.com/serejahh/UnboxedAlamofire
alamofire carthage cocoapods ios json macos swift unbox
Last synced: 6 days ago
JSON representation
[Deprecated] Alamofire + Unbox: the easiest way to download and decode JSON into swift objects.
- Host: GitHub
- URL: https://github.com/serejahh/UnboxedAlamofire
- Owner: serejahh
- License: mit
- Archived: true
- Created: 2016-07-31T19:05:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T06:51:32.000Z (over 3 years ago)
- Last Synced: 2024-09-15T19:34:14.060Z (3 months ago)
- Topics: alamofire, carthage, cocoapods, ios, json, macos, swift, unbox
- Language: Swift
- Homepage:
- Size: 60.5 KB
- Stars: 64
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - UnboxedAlamofire - Alamofire + Unbox: the easiest way to download and decode JSON into swift objects. (Networking / Video)
- awesome-ios-star - UnboxedAlamofire - Alamofire + Unbox: the easiest way to download and decode JSON into swift objects. (Networking / Video)
README
# UnboxedAlamofire
⚠️ **DEPRECATED**
UnboxedAlamofire is deprecated as well as [Unbox](https://github.com/JohnSundell/Unbox) is deprecated in favor of Swift’s built-in `Codable` API.
-----
[![Build Status](https://travis-ci.org/serejahh/UnboxedAlamofire.svg?branch=master)](https://travis-ci.org/serejahh/UnboxedAlamofire)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/UnboxedAlamofire.svg)](https://img.shields.io/cocoapods/v/UnboxedAlamofire.svg)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Platform](https://img.shields.io/cocoapods/p/UnboxedAlamofire.svg?style=flat)](http://cocoadocs.org/docsets/UnboxedAlamofire)[Alamofire](https://github.com/Alamofire/Alamofire) + [Unbox](https://github.com/JohnSundell/Unbox): the easiest way to download and decode JSON into swift objects.
## Features
- [x] Unit tested
- [x] Fully documented
- [x] Mapping response to objects
- [x] Mapping response to array of objects
- [x] Keypaths
- [x] Nested keypaths
- [x] For Swift 2.x use v. `1.x` and [swift2](https://github.com/serejahh/UnboxedAlamofire/tree/swift2) branch
- [x] For Swift 3.x use v. `2.x`## Usage
Objects you request have to conform [Unboxable](https://github.com/JohnSundell/Unbox#basic-example) protocol.
### Get an object
``` swift
Alamofire.request(url, method: .get).responseObject { (response: DataResponse) in
// handle response
let candy = response.result.value
// handle error
if let error = response.result.error as? UnboxedAlamofireError {
print("error: \(error.description)")
}
}
```### Get an array
``` swift
Alamofire.request(url, method: .get).responseArray { (response: DataResponse<[Candy]>) in
// handle response
let candies = response.result.value
// handle error
if let error = response.result.error as? UnboxedAlamofireError {
print("error: \(error.description)")
}
}
```### KeyPath
Also you can specify a keypath in both requests:
``` swift
Alamofire.request(url, method: .get).responseObject(keyPath: "response") { (response: DataResponse) in
// handle response
let candy = response.result.value
// handle error
if let error = response.result.error as? UnboxedAlamofireError {
print("error: \(error.description)")
}
}
```## Installation
### [CocoaPods](https://cocoapods.org/)
```
pod 'UnboxedAlamofire', '~> 2.0'
```### [Carthage](https://github.com/Carthage/Carthage)
```
github "serejahh/UnboxedAlamofire" ~> 2.0
```