Swift PromiseKitPromoises 模式库
Swift PromiseKit 是为 iOS 上实现的一个 Promoises 模式库,使用 Swift 编写。
示例代码:
CLLocationManager.promise().catch { // If location cannot be determined, default to Chicago return CLLocation(latitude: 41.89, longitude: -87.63) }.then { let (lat, lon) = ($0.coordinate.latitude, $0.coordinate.longitude) return NSURLConnection.GET("http://user.net/\(lat)/\(lon)") }.then { user in let alert = UIAlertView() alert.title = "Hi " + user["name"] alert.addButtonWithTitle("Bye") alert.addButtonWithTitle("Hi") return alert.promise() }.then { tappedButtonIndex -> Promise<Void>? in if tappedButtonIndex == 0 { return nil } let vc = HelloViewController() return self.promiseViewController(vc).then { (modallyPresentedResult:String) -> Void in //… } }.catch { error in //… }
评论
OCMapperObjective-C & Swift 库
OCMapper 是 Objective-C 和 Swift 库,它可以很容易地将 NSDictio
OCMapperObjective-C & Swift 库
0
OCMapperObjective-C & Swift 库
OCMapper是Objective-C和Swift库,它可以很容易地将NSDictionary映射到模型目标上。
OCMapperObjective-C & Swift 库
0
UIClosuresUIKit 的 Swift closure 库
UIClosures是用Swift写成的closure库,用于UIKit。简单示例:button.on(.TouchUpInside, (sender: AnyObject) -> () {
UIClosuresUIKit 的 Swift closure 库
0
UIClosuresUIKit 的 Swift closure 库
UIClosures 是用 Swift 写成的 closure 库,用于 UIKit。简单示例:bu
UIClosuresUIKit 的 Swift closure 库
0
FHIRModelsFHIR 资源数据模型 Swift 库
FHIRModels是一个用于FHIR®资源数据模型的Swift库。特征FHIR资源、元素和数据类型的本机Swift表示DSTU2、STU3、R4、R4B、R5和最新构建版本的单独目标强制参数的强制不
FHIRModelsFHIR 资源数据模型 Swift 库
0
matches.jsJavaScript模式匹配库
matches.js 是一个开源的JavaScript模式匹配库,示例代码:var pattern
matches.jsJavaScript模式匹配库
0