美文网首页
PromiseKit

PromiseKit

作者: 曾柏超 | 来源:发表于2018-01-11 15:35 被阅读0次

Promises simplify asynchronous programming, freeing you up to focus on the more important things. They are easy to learn, easy to master and result in clearer, more readable code. Your co-workers will thank you.


UIApplication.shared.isNetworkActivityIndicatorVisible = true

firstly {
    when(URLSession.dataTask(with: url).asImage(), CLLocationManager.promise())
}.then { image, location -> Void in
    self.imageView.image = image
    self.label.text = "\(location)"
}.always {
    UIApplication.shared.isNetworkActivityIndicatorVisible = false
}.catch { error in
    self.show(UIAlertController(for: error), sender: self)
}

PromiseKit is a thoughtful and complete implementation of promises for any platform with a swiftc, it has excellent Objective-C bridging and delightful specializations for iOS, macOS, tvOS and watchOS. It is a top-100 pod used in many of the most popular apps in the world.

相关文章

  • 讨厌使用block嵌套了吗,试试promisekit

    http://promisekit.org

  • PromiseKit 概要

    对PromiseKit理解 PromiseKit 只是 Promise 设计模式的一种实现方式。并不能为我们的 a...

  • Objective-C 之 PromiseKit入门

    一、PromiseKit介绍 PromiseKit,优雅的的管理多个异步操作,让你从此远离多层嵌套。 用一个例子作...

  • PromiseKit

    Promises simplify asynchronous programming, freeing you u...

  • swift PromiseKit入门 - promise war

    PromiseKit是个啥 官方描述: Promises simplify asynchronous progra...

  • PromiseKit 使用

    看到这样的代码你的内心应该是一万匹草泥马跑过了吧! 你内心的代码肯定应该是这样的 她优雅,干净,易懂。如同初恋一般...

  • PromiseKit 附录

    全部文章简介基础部分快速上手Promise 的常见模式常见问题进阶部分故障排除附录API 说明 以下是对 Prom...

  • PromiseKit 简介

    全部文章简介基础部分快速上手Promise 的常见模式常见问题进阶部分故障排除附录API 说明 以下是对 Prom...

  • 链接

    https://github.com/mxcl/PromiseKit https://github.com/Rea...

  • PromiseKit+OMGHTTPURLRQ+Codable+

    PromiseKit+OMGHTTPURLRQ+Codable+泛型 - 让请求更加清爽清晰 可以通过cocoap...

网友评论

      本文标题:PromiseKit

      本文链接:https://www.haomeiwen.com/subject/vlftoxtx.html