注册

iOS 异步开发 PromiseKit

现代化的开发都要求高度异步,iOS 开发也是一样,PromiseKit 能提供强大的 iOS 开发异步功能,非常容易使用。PromiseKit 不仅仅是 Promises 的实现,还是辅助函数的集合,使得 iOS 开发典型的异步模式更强大。PromiseKit 支持集成到其他 Cocoapods,如果用户的库有异步**作,而又喜欢使用 PromiseKit,则可以添加了一个可选的缺省子说明书,提供 Promises 服务,文档会帮助集成 PromiseKit 到用户自身的 pods 中。示例:
.catch(^{
return self.chicagoLocation;}).then(^(CLLocation *loc){
return ;}).then(^(NSDictionary *user){
UIAlertView *alert = ;
alert.title = ;
;
;
return alert.promise;}).then(^(NSNumber *tappedButtonIndex, UIAlertView *alert){
if (tappedButtonIndex.intValue == alert.cancelButtonIndex)
return nil;
id vc =
return .then(^(id resultFromViewController){
//…
});}).catch(^(NSError *err){
//…});下载地址:github.com/mxcl/PromiseKit/releases
已邀请:

要回复问题请先登录注册