AlamofireObjectMapperPromise
需求
安装
AlamofireObjectMapperPromise 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'AlamofireObjectMapperPromise'
使用方法
映射对象
// 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()
}
数组
// func responseArray<T: BaseMappable>(queue: DispatchQueue? = nil, keyPath: String? = nil, context: MapContext? = nil) -> Promise<[T]>
func fetchMessages() -> Promise<[Message]> {
return Alamofire.request(url)
.responseArray()
}
作者
张志华, [email protected]
许可
AlamofireObjectMapperPromise 以 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。