{"id":15028656,"url":"https://github.com/mxcl/promisekit","last_synced_at":"2025-05-13T11:08:08.914Z","repository":{"id":15702698,"uuid":"18440563","full_name":"mxcl/PromiseKit","owner":"mxcl","description":"Promises for Swift \u0026 ObjC.","archived":false,"fork":false,"pushed_at":"2025-01-31T16:20:54.000Z","size":10686,"stargazers_count":14255,"open_issues_count":15,"forks_count":1456,"subscribers_count":254,"default_branch":"master","last_synced_at":"2025-05-13T11:07:57.905Z","etag":null,"topics":["objc","promises","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mxcl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"mxcl","patreon":"mxcl"}},"created_at":"2014-04-04T13:54:37.000Z","updated_at":"2025-05-08T09:55:01.000Z","dependencies_parsed_at":"2022-07-12T05:18:29.999Z","dependency_job_id":"1e36a06e-e5d7-4b20-99e9-f7608c54cf98","html_url":"https://github.com/mxcl/PromiseKit","commit_stats":{"total_commits":1324,"total_committers":166,"mean_commits":7.975903614457831,"dds":0.3104229607250756,"last_synced_commit":"1df6e3dc2fb9d7b26081ddf730a9a1e39ad9fa24"},"previous_names":[],"tags_count":218,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxcl%2FPromiseKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxcl%2FPromiseKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxcl%2FPromiseKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxcl%2FPromiseKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxcl","download_url":"https://codeload.github.com/mxcl/PromiseKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253929367,"owners_count":21985802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["objc","promises","swift"],"created_at":"2024-09-24T20:08:49.880Z","updated_at":"2025-05-13T11:08:08.869Z","avatar_url":"https://github.com/mxcl.png","language":"Swift","readme":"![PromiseKit](../gh-pages/public/img/logo-tight.png)\n\n[![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)\n\n---\n\nPromises simplify asynchronous programming, freeing you up to focus on the more\nimportant things. They are easy to learn, easy to master and result in clearer,\nmore readable code. Your co-workers will thank you.\n\n```swift\nUIApplication.shared.isNetworkActivityIndicatorVisible = true\n\nlet fetchImage = URLSession.shared.dataTask(.promise, with: url).compactMap{ UIImage(data: $0.data) }\nlet fetchLocation = CLLocationManager.requestLocation().lastValue\n\nfirstly {\n    when(fulfilled: fetchImage, fetchLocation)\n}.done { image, location in\n    self.imageView.image = image\n    self.label.text = \"\\(location)\"\n}.ensure {\n    UIApplication.shared.isNetworkActivityIndicatorVisible = false\n}.catch { error in\n    self.show(UIAlertController(for: error), sender: self)\n}\n```\n\nPromiseKit is a thoughtful and complete implementation of promises for any\nplatform that has a `swiftc`. It has *excellent* Objective-C bridging and\n*delightful* specializations for iOS, macOS, tvOS and watchOS. It is a top-100\npod used in many of the most popular apps in the world.\n\n[![codecov](https://codecov.io/gh/mxcl/PromiseKit/branch/master/graph/badge.svg)](https://codecov.io/gh/mxcl/PromiseKit)\n\n# Quick Start\n\nIn your [Podfile]:\n\n```ruby\nuse_frameworks!\n\ntarget \"Change Me!\" do\n  pod \"PromiseKit\", \"~\u003e 8\"\nend\n```\n\nPromiseKit 8 supports recent Xcodes (13+). Some Podspecs were\n[dropped as a result](https://github.com/mxcl/PromiseKit/pull/1318).\nPull requests are welcome.\n\nPromiseKit 6, 5 and 4 support Xcode 8.3, 9.x and 10.0; Swift 3.1,\n3.2, 3.3, 3.4, 4.0, 4.1, 4.2, 4.3 and 5.0 (development snapshots); iOS, macOS,\ntvOS, watchOS, Linux and Android; CocoaPods, Carthage and SwiftPM;\n([CI Matrix](https://travis-ci.org/mxcl/PromiseKit)).\n\nFor Carthage, SwiftPM, Accio, etc., or for instructions when using older Swifts or Xcodes, see our [Installation Guide]. We recommend\n[Carthage](https://github.com/Carthage/Carthage) or\n[Accio](https://github.com/JamitLabs/Accio).\n\n# PromiseKit and Swift 5.5+ Async/Await\n\nAs 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.\n\n# Professionally Supported PromiseKit is Now Available\n\nTideLift gives software development teams a single source for purchasing\nand maintaining their software, with professional grade assurances from\nthe experts who know it best, while seamlessly integrating with existing\ntools.\n\n[Get Professional Support for PromiseKit with TideLift](https://tidelift.com/subscription/pkg/cocoapods-promisekit?utm_source=cocoapods-promisekit\u0026utm_medium=referral\u0026utm_campaign=readme).\n\n\n# Documentation\n\n* Handbook\n  * [Getting Started](Documentation/GettingStarted.md)\n  * [Promises: Common Patterns](Documentation/CommonPatterns.md)\n  * [Frequently Asked Questions](Documentation/FAQ.md)\n* Manual\n  * [Installation Guide](Documentation/Installation.md)\n  * [Objective-C Guide](Documentation/ObjectiveC.md)\n  * [Troubleshooting](Documentation/Troubleshooting.md) (e.g., solutions to common compile errors)\n  * [Appendix](Documentation/Appendix.md)\n* [API Reference](https://mxcl.dev/PromiseKit/reference/v6/Classes/Promise.html)\n\n# Extensions\n\nPromises are only as useful as the asynchronous tasks they represent. Thus, we\nhave converted (almost) all of Apple’s APIs to promises. The default CocoaPod\nprovides Promises and the extensions for Foundation and UIKit. The other\nextensions are available by specifying additional subspecs in your `Podfile`,\ne.g.:\n\n```ruby\npod \"PromiseKit/MapKit\"          # MKDirections().calculate().then { /*…*/ }\npod \"PromiseKit/CoreLocation\"    # CLLocationManager.requestLocation().then { /*…*/ }\n```\n\nAll our extensions are separate repositories at the [PromiseKit organization].\n\n## I don't want the extensions!\n\nThen don’t have them:\n\n```ruby\npod \"PromiseKit/CorePromise\", \"~\u003e 8\"\n```\n\n\u003e *Note:* Carthage installations come with no extensions by default.\n\n## Networking\n\nPromise chains commonly start with a network operation. Thus, we offer\nextensions for `URLSession`:\n\n```swift\n// pod 'PromiseKit/Foundation'  # https://github.com/PromiseKit/Foundation\n\nfirstly {\n    URLSession.shared.dataTask(.promise, with: try makeUrlRequest()).validate()\n    // ^^ we provide `.validate()` so that eg. 404s get converted to errors\n}.map {\n    try JSONDecoder().decode(Foo.self, with: $0.data)\n}.done { foo in\n    //…\n}.catch { error in\n    //…\n}\n\nfunc makeUrlRequest() throws -\u003e URLRequest {\n    var rq = URLRequest(url: url)\n    rq.httpMethod = \"POST\"\n    rq.addValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\n    rq.addValue(\"application/json\", forHTTPHeaderField: \"Accept\")\n    rq.httpBody = try JSONEncoder().encode(obj)\n    return rq\n}\n```\n\nSupport for Alamofire is welcome, please submit a PR.\n\n\n# Support\n\nPlease check our [Troubleshooting Guide](Documentation/Troubleshooting.md), and\nif after that you still have a question, ask at our [Gitter chat channel] or on [our bug tracker].\n\n## Security \u0026 Vulnerability Reporting or Disclosure\n\nhttps://tidelift.com/security\n\n\n[badge-pod]: https://img.shields.io/cocoapods/v/PromiseKit.svg?label=version\n[badge-pms]: https://img.shields.io/badge/supports-CocoaPods%20%7C%20Carthage%20%7C%20Accio%20%7C%20SwiftPM-green.svg\n[badge-languages]: https://img.shields.io/badge/languages-Swift%20%7C%20ObjC-orange.svg\n[badge-platforms]: https://img.shields.io/badge/platforms-macOS%20%7C%20iOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-lightgrey.svg\n[badge-mit]: https://img.shields.io/badge/license-MIT-blue.svg\n[OMGHTTPURLRQ]: https://github.com/PromiseKit/OMGHTTPURLRQ\n[Alamofire]: http://github.com/PromiseKit/Alamofire-\n[PromiseKit organization]: https://github.com/PromiseKit\n[Gitter chat channel]: https://gitter.im/mxcl/PromiseKit\n[our bug tracker]: https://github.com/mxcl/PromiseKit/issues/new\n[Podfile]: https://guides.cocoapods.org/syntax/podfile.html\n[PMK6]: http://mxcl.dev/PromiseKit/news/2018/02/PromiseKit-6.0-Released/\n[Installation Guide]: Documentation/Installation.md\n[badge-travis]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=master\n[travis]: https://travis-ci.org/mxcl/PromiseKit\n[cocoapods]: https://cocoapods.org/pods/PromiseKit\n","funding_links":["https://github.com/sponsors/mxcl","https://patreon.com/mxcl","https://tidelift.com/subscription/pkg/cocoapods-promisekit?utm_source=cocoapods-promisekit\u0026utm_medium=referral\u0026utm_campaign=readme","https://tidelift.com/security"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxcl%2Fpromisekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxcl%2Fpromisekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxcl%2Fpromisekit/lists"}