zhz821 / AlamofireObjectMapperPromise

Use PromiseKit and AlamofireObjectMapper together

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AlamofireObjectMapperPromise

CI Status Version License Platform

Requirements

Installation

AlamofireObjectMapperPromise is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AlamofireObjectMapperPromise'

Usage

Map Object

// func responseObject<T: BaseMappable>(queue: DispatchQueue? = nil, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil) -> Promise<T>
    
func fetchUserInfo() -> Promise<UserInfo> {
    return Alamofire.request(url)
        .responseObject()
}

Map Array

// func responseArray<T: BaseMappable>(queue: DispatchQueue? = nil, keyPath: String? = nil, context: MapContext? = nil) -> Promise<[T]>

func fetchMessages() -> Promise<[Message]> {
    return Alamofire.request(url)
        .responseArray()
}

Author

ZhihuaZhang, shika.cho@kapps.co.jp

License

AlamofireObjectMapperPromise is available under the MIT license. See the LICENSE file for more info.

About

Use PromiseKit and AlamofireObjectMapper together

License:MIT License


Languages

Language:Swift 54.7%Language:Ruby 45.3%