登录 注册

PromiseKit

去点 Star
其他 objcpromisesswift
14,205
Stars
1,454
Forks
245
Watchers
16
Open Issues
MIT
许可证
Swift
语言
2014-04-04
创建时间
2026-06-03
最近更新

项目能做什么

适用于 Swift 和 ObjC 的 Promise 库。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
![PromiseKit](../gh-pages/public/img/logo-tight.png)

[![badge-pod][]][cocoapods] ![badge-languages][] ![badge-pms][] ![badge-platforms][] [![codecov](https://codecov.io/gh/mxcl/PromiseKit/branch/master/graph/badge.svg?token=wHSAz7N8WA)](https://codecov.io/gh/mxcl/PromiseKit)

---

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.

```swift
UIApplication.shared.isNetworkActivityIndicatorVisible = true

let fetchImage = URLSession.shared.dataTask(.promise, with: url).compactMap{ UIImage(data: $0.data) }
let fetchLocation = CLLocationManager.requestLocation().lastValue

firstly {
    when(fulfilled: fetchImage, fetchLocation)
}.done { image, location in
    self.imageView.image = image
    self.label.text = "\(location)"
}.ensure {
    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 that has 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.

[![codecov](https://codecov.io/gh/mxcl/PromiseKit/branch/master/graph/badge.svg)](https://codecov.io/gh/mxcl/PromiseKit)

# Quick Start

In your [Podfile]:

```ruby
use_frameworks!

target "Change Me!" do
  pod "PromiseKit", "~> 8"
end
```

PromiseKit 8 supports recent Xcodes (13+). Some Podspecs were
[dropped as a result](https://github.com/mxcl/PromiseKit/pull/1318).
Pull requests are welcome.

PromiseKit 6, 5 and 4 support Xcode 8.3, 9.x and 10.0; Swift 3.1,
3.2, 3.3, 3.4, 4.0, 4.1, 4.2, 4.3 and 5.0 (development snapshots); iOS, macOS,
tvOS, watchOS, Linux and Android; CocoaPods, Carthage and SwiftPM;
([CI Matrix](https://travis-ci.org/mxcl/PromiseKit)).

For Carthage, SwiftPM, Accio, etc., or for instructions when using older Swifts or Xcodes, see our [Installation Guide]. We recommend
[Carthage](https://github.com/Carthage/Carthage) or
[Accio](https://github.com/JamitLabs/Accio).

# PromiseKit and Swift 5.5+ Async/Await

As of Swift 5.5, the Swift language now offers support for [built-in concurrency with async / await](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html).  See [Async+](https://github.com/async-plus/async-plus) for a port of PromiseKit's most useful patterns to this new paradigm.

# Professionally Supported PromiseKit is Now Available

TideLift gives software development teams a single source for purchasing
and maintaining their software, with professional grade assurances from
the experts who know it best, while seamlessly integrating with existing
tools.

[Get Professional Support for PromiseKit with TideLift](https://tidelift.com/subscription/pkg/cocoapods-promisekit?utm_source=cocoapods-promisek
阅读完整原文

项目深度分析 AI 生成

PromiseKit 到 Swift Concurrency 自动化迁移助手 (CLI & 重构插件)

产品构想构建一套 AST 级别的代码重构分析工具,自动化将 PromiseKit 的链式调用(then/done/catch/ensure)转换为 Swift 原生 async/await 及 TaskGroup 语法,降低人工重构风险与时间成本。
核心功能代码语法树语义分析、链式调用自动化重写、错误处理语义对齐检测、混合调用过渡桥接生成、重构后自动化测试桩生成。
目标用户需要升级技术栈、摆脱第三方底层依赖的中大型 iOS 团队和技术负责人。
难度/周期高 · 3-6个月 · 成本:开发机器与代码分析测试套件,主要成本为大量复杂 Swift AST 及宏/重构规则编写的人力时间成本。
收费模式免费扫描评估 + 商业许可证授权(按代码仓库/代码行数收费)或单次迁移服务费用。
竞争风险Swift 原生并发机制涉及复杂的线程/Actor 隔离,复杂嵌套和闭包捕获逻辑的自动化迁移可能引发死锁或数据竞争问题,需大量边界案例测试。
依据 已验证事实

大型遗留项目技术债治理与迁移咨询服务

产品构想依托对 PromiseKit 核心源码及 Swift 现代并发架构的深入理解,为金融、零售等具有庞大历史 Swift/ObjC 代码库的企业提供定制化架构改造、代码迁移咨询与 SLA 级维护支持。
核心功能架构体检与技术债报告、定制迁移方案制定、关键模块重构代写、核心开发团队并发编程培训、紧急 Bug 修复 LTS 保证。
目标用户维护数百万行代码、重构预算充足且安全合规要求极高的企业架构团队。
难度/周期中等 · 按项目周期(通常 1-3 个月/项目) · 成本:个人/小型专家咨询团队时间成本,获客成本。
收费模式按人天/人月收取的专业企业咨询服务费或交钥匙重构项目制收费。
竞争风险销售周期长,高度依赖个人专家声誉和 B 端商务拓展能力,难以规模化标准化。
依据 数据支持的判断

现代 Swift 异步架构最佳实践与重构实战课程/专栏

产品构想针对 iOS 开发者普遍面临的“从传统闭包/PromiseKit 转型为 Swift 结构化并发”的技术门槛,制作高阶工程实践课程,深度剖析异步状态管理、混合架构调试及性能陷阱。
核心功能Promise 模式与 Actor/Task 内部机理深度对比、跨范式设计模式重构实录、数据竞争排查与性能剖析专项教程、配套实战代码演练。
目标用户寻求技术进阶的中高级 iOS 开发工程师、从 Objective-C/旧 Swift 转型到现代 Swift 的个人开发者。
难度/周期低 · 1-2个月 · 成本:课程录制与制作、平台分销佣金支出。
收费模式数字内容销售(通过技术付费专栏、小册、视频平台买断制销售)。
竞争风险官方文档与开源社区免费教程日益丰富,纯内容付费客单价较低且容易受盗版冲击。
依据 AI推测
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

相似项目数据正在完善中,暂不展示(避免误导)

项目优势与风险

技术成熟度创建于 2014-04-04,最近推送 2026-06-03,发布过 83 个 Release
社区活跃Star 14,205 / Fork 1,454 / Issue 16(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。