Full Code of mxcl/PromiseKit for AI

master 8c0734982392 cached
135 files
544.2 KB
143.5k tokens
1 symbols
1 requests
Download .txt
Showing preview only (580K chars total). Download the full file or copy to clipboard to get everything.
Repository: mxcl/PromiseKit
Branch: master
Commit: 8c0734982392
Files: 135
Total size: 544.2 KB

Directory structure:
gitextract_8yos49k1/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── LinuxMain.stencil
│   ├── codecov.yml
│   ├── jazzy.yml
│   ├── ranger.yml
│   ├── sourcery.yml
│   └── workflows/
│       ├── cd.yml
│       ├── ci-podspec.yml
│       ├── ci.yml
│       └── publish.yml
├── .gitignore
├── .gitmodules
├── .tidelift.yml
├── .travis.yml
├── Documentation/
│   ├── Appendix.md
│   ├── CommonPatterns.md
│   ├── Examples/
│   │   ├── ImageCache.md
│   │   ├── URLSession+BadResponseErrors.swift
│   │   └── detweet.swift
│   ├── FAQ.md
│   ├── GettingStarted.md
│   ├── Installation.md
│   ├── ObjectiveC.md
│   ├── README.md
│   └── Troubleshooting.md
├── LICENSE
├── Package.swift
├── Package@swift-4.2.swift
├── Package@swift-5.0.swift
├── Package@swift-5.3.swift
├── PromiseKit.playground/
│   ├── Contents.swift
│   ├── contents.xcplayground
│   └── playground.xcworkspace/
│       └── contents.xcworkspacedata
├── PromiseKit.podspec
├── PromiseKit.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   └── xcshareddata/
│   │       ├── IDEWorkspaceChecks.plist
│   │       └── WorkspaceSettings.xcsettings
│   └── xcshareddata/
│       └── xcschemes/
│           └── PromiseKit.xcscheme
├── README.md
├── Sources/
│   ├── AnyPromise+Private.h
│   ├── AnyPromise.h
│   ├── AnyPromise.m
│   ├── AnyPromise.swift
│   ├── Async.swift
│   ├── Box.swift
│   ├── Catchable.swift
│   ├── Combine.swift
│   ├── Configuration.swift
│   ├── CustomStringConvertible.swift
│   ├── Deprecations.swift
│   ├── Error.swift
│   ├── Guarantee.swift
│   ├── Info.plist
│   ├── LogEvent.swift
│   ├── NSMethodSignatureForBlock.m
│   ├── PMKCallVariadicBlock.m
│   ├── Promise.swift
│   ├── PromiseKit.h
│   ├── Resolver.swift
│   ├── Resources/
│   │   └── PrivacyInfo.xcprivacy
│   ├── Thenable.swift
│   ├── after.m
│   ├── after.swift
│   ├── dispatch_promise.m
│   ├── firstly.swift
│   ├── fwd.h
│   ├── hang.m
│   ├── hang.swift
│   ├── join.m
│   ├── race.m
│   ├── race.swift
│   ├── when.m
│   └── when.swift
├── Tests/
│   ├── A+/
│   │   ├── 0.0.0.swift
│   │   ├── 2.1.2.swift
│   │   ├── 2.1.3.swift
│   │   ├── 2.2.2.swift
│   │   ├── 2.2.3.swift
│   │   ├── 2.2.4.swift
│   │   ├── 2.2.6.swift
│   │   ├── 2.2.7.swift
│   │   ├── 2.3.1.swift
│   │   ├── 2.3.2.swift
│   │   ├── 2.3.4.swift
│   │   ├── README.md
│   │   └── XCTestManifests.swift
│   ├── Bridging/
│   │   ├── BridgingTests.m
│   │   ├── BridgingTests.swift
│   │   ├── Infrastructure.h
│   │   ├── Infrastructure.m
│   │   └── Infrastructure.swift
│   ├── CoreObjC/
│   │   ├── AnyPromiseTests.m
│   │   ├── AnyPromiseTests.swift
│   │   ├── HangTests.m
│   │   ├── JoinTests.m
│   │   ├── PMKManifoldTests.m
│   │   ├── RaceTests.m
│   │   └── WhenTests.m
│   ├── CorePromise/
│   │   ├── AfterTests.swift
│   │   ├── AsyncTests.swift
│   │   ├── CancellableErrorTests.swift
│   │   ├── CatchableTests.swift
│   │   ├── CombineTests.swift
│   │   ├── DefaultDispatchQueueTests.swift
│   │   ├── ErrorTests.swift
│   │   ├── GuaranteeTests.swift
│   │   ├── HangTests.swift
│   │   ├── LoggingTests.swift
│   │   ├── PromiseTests.swift
│   │   ├── RaceTests.swift
│   │   ├── RegressionTests.swift
│   │   ├── ResolverTests.swift
│   │   ├── StressTests.swift
│   │   ├── ThenableTests.swift
│   │   ├── Utilities.swift
│   │   ├── WhenConcurrentTests.swift
│   │   ├── WhenResolvedTests.swift
│   │   ├── WhenTests.swift
│   │   ├── XCTestManifests.swift
│   │   └── ZalgoTests.swift
│   ├── DeprecationTests.swift
│   ├── JS-A+/
│   │   ├── .gitignore
│   │   ├── AllTests.swift
│   │   ├── JSAdapter.swift
│   │   ├── JSPromise.swift
│   │   ├── JSUtils.swift
│   │   ├── MockNodeEnvironment.swift
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── package.json
│   │   └── webpack.config.js
│   └── LinuxMain.swift
└── tea.yaml

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
tidelift: "cocoapods/PromiseKit"
patreon: "mxcl"
github: mxcl


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
[PLEASE READ THE TROUBLESHOOTING GUIDE](https://github.com/mxcl/PromiseKit/blob/master/Documentation/Troubleshooting.md).

---

You read the guide but it didn’t help? OK, we’re here to help.

* Please specify the PromiseKit major version you are using
* [Please format your code in triple backticks and ensure readable indentation](https://help.github.com/articles/creating-and-highlighting-code-blocks/)
* Please specify how you installed PromiseKit, ie. Carthage, CocoaPods, SwiftPM or other. If other provide DETAILED information about how you are integrating PromiseKit.

If you ignore this template we will close your ticket and link to this template until you provide this necessary information. We cannot help you without it.


================================================
FILE: .github/LinuxMain.stencil
================================================
@testable import Core
@testable import A_
import XCTest

//TODO get this to run on CI and don’t have it committed
//NOTE problem is Sourcery doesn’t support Linux currently
//USAGE: cd PromiseKit/Sources/.. && sourcery --config .github/sourcery.yml

{% for type in types.classes|based:"XCTestCase" %}
extension {{ type.name }} {
    static var allTests = [
    {% for method in type.methods %}{% if method.parameters.count == 0 and method.shortName|hasPrefix:"test" %}    ("{{ method.shortName }}", {{type.name}}.{{ method.shortName }}),
    {% endif %}{% endfor %}]
}

{% endfor %}
XCTMain([
{% for type in types.classes|based:"XCTestCase" %}{% if not type.annotations.excludeFromLinuxMain %}    testCase({{ type.name }}.allTests),
{% endif %}{% endfor %}])


================================================
FILE: .github/codecov.yml
================================================
ignore:
  - "Tests"
  - "README.md"
  - "Documentation"
  - ".travis.yml"

codecov:
  notify:
    require_ci_to_pass: yes

coverage:
  precision: 1
  round: up
  range: "70...100"

  status:
    project: yes
    patch:
      default:
        threshold: 0.2%
    changes: no

parsers:
  gcov:
    branch_detection:
      conditional: yes
      loop: yes
      method: no
      macro: no

comment: off


================================================
FILE: .github/jazzy.yml
================================================
module: PromiseKit
custom_categories:
  - name: Core Components
    children:
      - Promise
      - Guarantee
      - Thenable
      - CatchMixin
      - Resolver
xcodebuild_arguments:
  - UseModernBuildSystem=NO
output:
  ../output
  # output directory is relative to config file… ugh
readme:
  Documentation/README.md
theme:
  fullwidth


================================================
FILE: .github/ranger.yml
================================================
merges:
  - action: delete_branch


================================================
FILE: .github/sourcery.yml
================================================
sources:
  include:
    - ../Tests/A+
    - ../Tests/CorePromise
  exclude:
    - ../Tests/A+/0.0.0.swift
    - ../Tests/CorePromise/Utilities.swift
templates:
  include:
    - LinuxMain.stencil
output:
  ../Tests/LinuxMain.swift


================================================
FILE: .github/workflows/cd.yml
================================================
name: CD
on:
  workflow_dispatch:
    inputs:
      version:
        required: true
jobs:
  pods:
    runs-on: macos-latest
    steps:

    - name: Start Deployment
      uses: bobheadxi/deployments@v0.5.2
      id: deployment
      with:
        step: start
        token: ${{ secrets.GITHUB_TOKEN }}
        env: pods

    - uses: actions/checkout@v3
      with:
        submodules: true

    - run: pod trunk push --allow-warnings --skip-tests --skip-import-validation
      env:
        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

    - name: Seal Deployment
      uses: bobheadxi/deployments@v0.5.2
      if: always()
      with:
        step: finish
        token: ${{ secrets.GITHUB_TOKEN }}
        status: ${{ job.status }}
        deployment_id: ${{ steps.deployment.outputs.deployment_id }}

  # carthage:
  #   runs-on: macos-latest
  #   steps:

  #   - name: Start Deployment
  #     uses: bobheadxi/deployments@v0.5.2
  #     id: deployment
  #     with:
  #       step: start
  #       token: ${{ secrets.GITHUB_TOKEN }}
  #       env: carthage

  #   - uses: maxim-lobanov/setup-xcode@v1
  #     with:
  #       xcode-version: ^11
  #       # Waiting on https://github.com/Carthage/Carthage/issues/3103 for Xcode 12

  #   - uses: joutvhu/get-release@v1
  #     id: release
  #     with:
  #       tag_name: ${{ github.event.inputs.version }}
  #     env:
  #       GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  #   - uses: actions/checkout@v2
  #   - run: carthage build --no-skip-current --platform macOS,iOS,watchOS,tvOS --archive
  #   - run: mv PromiseKit.framework.zip PromiseKit-$v.framework.zip

  #   - uses: actions/upload-release-asset@v1
  #     with:
  #       upload_url: ${{ steps.release.outputs.upload_url }}
  #       asset_path: ./PromiseKit-${{ github.event.inputs.version }}.framework.zip
  #       asset_name: PromiseKit-${{ github.event.inputs.version }}.framework.zip
  #       asset_content_type: application/zip
  #     env:
  #       GITHUB_TOKEN: ${{ github.token }}

  #   - name: Seal Deployment
  #     uses: bobheadxi/deployments@v0.5.2
  #     if: always()
  #     with:
  #       step: finish
  #       token: ${{ secrets.GITHUB_TOKEN }}
  #       status: ${{ job.status }}
  #       deployment_id: ${{ steps.deployment.outputs.deployment_id }}

  docs:
    runs-on: macos-latest
    steps:

    - name: Start Deployment
      uses: bobheadxi/deployments@v0.5.2
      id: deployment
      with:
        step: start
        token: ${{ secrets.GITHUB_TOKEN }}
        env: docs

    - uses: actions/checkout@v2
    - run: gem install jazzy
    - run: |
        jazzy --config .github/jazzy.yml \
          --github_url 'https://github.com/mxcl/PromiseKit' \
          --module-version ${{ github.event.inputs.version }}
    - run: git remote update
    - run: git checkout gh-pages
    - run: rm -rf reference/v6
    - run: mv output reference/v6
    - run: git add reference/v6
    - run: git config user.name github-actions
    - run: git config user.email github-actions@github.com
    - run: git commit -m 'Updated docs for v${{ github.event.inputs.version }}'
    - run: git remote add secure-origin https://${{ secrets.JAZZY_PAT }}@github.com/mxcl/PromiseKit.git
    - run: git push secure-origin gh-pages

    - name: Seal Deployment
      uses: bobheadxi/deployments@v0.5.2
      if: always()
      with:
        step: finish
        token: ${{ secrets.GITHUB_TOKEN }}
        status: ${{ job.status }}
        deployment_id: ${{ steps.deployment.outputs.deployment_id }}


================================================
FILE: .github/workflows/ci-podspec.yml
================================================
on:
  workflow_dispatch:
  pull_request:
    paths:
      - PromiseKit.podspec
jobs:
  lint:
    runs-on: macos-15
    steps:
    - uses: maxim-lobanov/setup-xcode@v1
      with:
        xcode-version: 16
    - uses: maxim-lobanov/setup-cocoapods@v1
      with:
        version: 1.16.2
    - uses: actions/checkout@v2
      with:
        submodules: true
    - run: pod lib lint --fail-fast --allow-warnings


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI

on:
  workflow_dispatch:
  workflow_call:
  pull_request:
    paths:
      - Sources/**
      - Tests/**
      - .github/workflows/ci.yml
      - PromiseKit.xcodeproj/**

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  linux-build:
    name: Linux (Swift ${{ matrix.swift }})
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        swift:
        - '4.0'
        - '4.1'
        - '4.2'
    container:
      image: swift:${{ matrix.swift }}
    steps:
    - uses: actions/checkout@v1 # DO NOT UPDATE ∵ failure on older containers due to old glibc
    - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 3
    - run: swift build  # can’t test ∵ generated linuxmain requires Swift 5

  linux-test:
    name: Linux (Swift ${{ matrix.swift }})
    runs-on: ubuntu-latest
    continue-on-error: true
    strategy:
      matrix:
        swift:
        - '5.0'
        - '5.1'
        - '5.2'
        - '5.3'
        - '5.4'
        - '5.5'
        - '5.6'
        - '5.7'
        - '5.8'
        - '5.9'
        - '5.10'
        - '6.0'
    container:
      image: swift:${{ matrix.swift }}
    steps:
    - uses: actions/checkout@v1 # DO NOT UPDATE ∵ failure on older containers due to old glibc
    - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 4
      if: ${{ matrix.swift < 6 }}
    - run: swift build -Xswiftc -warnings-as-errors -Xswiftc -swift-version -Xswiftc 4.2
      if: ${{ matrix.swift < 6 }}
    - run: swift test --enable-code-coverage --parallel

    - name: Generate Coverage Report
      if: ${{ matrix.swift >= 6 }}
      run: |
        apt-get -qq update
        apt-get -qq install llvm-18 curl
        export b=$(swift build --show-bin-path) && llvm-cov-18 \
          export -format lcov \
          -instr-profile=$b/codecov/default.profdata \
          --ignore-filename-regex='\.build/' \
          $b/*.xctest \
          > info.lcov

    - uses: codecov/codecov-action@v1
      with:
        file: ./info.lcov
      if: ${{ matrix.swift >= 6 }}

  test:
    runs-on: macos-latest
    name: ${{ matrix.platform }}
    continue-on-error: true
    strategy:
      matrix:
        platform:
          - macOS
          - watchOS
          - tvOS
          - iOS
          # - mac-catalyst
          # - visionOS
          # ^^ both are unavailable in the github-hosted runners
    steps:
    - uses: actions/checkout@v4
    - uses: mxcl/xcodebuild@v3
      with:
        platform: ${{ matrix.platform }}
        code-coverage: true
    - uses: codecov/codecov-action@v1

  test-android:
    name: Android
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: skiptools/swift-android-action@v2


================================================
FILE: .github/workflows/publish.yml
================================================
name: Publish

on:
  workflow_dispatch:
    inputs:
      version:
        description: semantic version to publish
        required: true

concurrency:
  group: publish-{{github.event.inputs.version}}
  cancel-in-progress: true

jobs:
  ci:
    uses: ./.github/workflows/ci.yml

  lint:
    runs-on: macos-latest
    strategy:
      matrix:
        xcode:
          - ^16
    steps:
    - uses: maxim-lobanov/setup-xcode@v1
      with:
        xcode-version: ${{ matrix.xcode }}
    - uses: actions/checkout@v3
      with:
        submodules: true
    - run: pod lib lint --fail-fast --allow-warnings

  create-release:
    runs-on: ubuntu-latest
    needs: [ci, lint]
    env:
      v: ${{ github.event.inputs.version }}
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0  # zero means “all” (or push fails)
    - name: Update committed versions
      run: |
        ruby -i -pe "sub(/CURRENT_PROJECT_VERSION = [0-9.]+/, 'CURRENT_PROJECT_VERSION = $v')" PromiseKit.xcodeproj/project.pbxproj
        ruby -i -pe "sub(/s.version = '[0-9.]+'/, 's.version = \'$v\'')" PromiseKit.podspec
    - run: |
        ! (git diff --quiet)
    - name: Commit
      run: |
        git config user.name github-actions
        git config user.email github-actions@github.com
        git commit -am "PromiseKit $v"
        git push
    - uses: softprops/action-gh-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.event.inputs.version }}
        name: ${{ github.event.inputs.version }}

  cd:
    needs: create-release
    runs-on: ubuntu-latest
    steps:
    - uses: aurelien-baudet/workflow-dispatch@v2
      with:
        workflow: CD
        token: ${{ secrets.JAZZY_PAT }}
        inputs: "{\"version\": \"${{ github.event.inputs.version }}\"}"
        ref: ${{ env.GITHUB_REF_NAME }}  # or uses the SHA rather than branch and thus the above commit is not used
        wait-for-completion: true


================================================
FILE: .gitignore
================================================
*.xcodeproj/**/xcuserdata/
*.xcscmblueprint
/Carthage
/.build
.DS_Store
DerivedData
/Extensions/Carthage
/Tests/JS-A+/build
.swiftpm/


================================================
FILE: .gitmodules
================================================
[submodule "Extensions/Foundation"]
	path = Extensions/Foundation
	url = https://github.com/PromiseKit/Foundation.git
[submodule "Extensions/UIKit"]
	path = Extensions/UIKit
	url = https://github.com/PromiseKit/UIKit.git
[submodule "Extensions/Accounts"]
	path = Extensions/Accounts
	url = https://github.com/PromiseKit/Accounts.git
[submodule "Extensions/MessagesUI"]
	path = Extensions/MessagesUI
	url = https://github.com/PromiseKit/MessagesUI.git
[submodule "Extensions/WatchConnectivity"]
	path = Extensions/WatchConnectivity
	url = https://github.com/PromiseKit/WatchConnectivity.git
[submodule "Extensions/Photos"]
	path = Extensions/Photos
	url = https://github.com/PromiseKit/Photos.git
[submodule "Extensions/MapKit"]
	path = Extensions/MapKit
	url = https://github.com/PromiseKit/MapKit.git
[submodule "Extensions/CloudKit"]
	path = Extensions/CloudKit
	url = https://github.com/PromiseKit/CloudKit.git
[submodule "Extensions/AddressBook"]
	path = Extensions/AddressBook
	url = https://github.com/PromiseKit/AddressBook.git
[submodule "Extensions/AssetsLibrary"]
	path = Extensions/AssetsLibrary
	url = https://github.com/PromiseKit/AssetsLibrary.git
[submodule "Extensions/CoreLocation"]
	path = Extensions/CoreLocation
	url = https://github.com/PromiseKit/CoreLocation.git
[submodule "Extensions/QuartzCore"]
	path = Extensions/QuartzCore
	url = https://github.com/PromiseKit/QuartzCore.git
[submodule "Extensions/Social"]
	path = Extensions/Social
	url = https://github.com/PromiseKit/Social.git
[submodule "Extensions/StoreKit"]
	path = Extensions/StoreKit
	url = https://github.com/PromiseKit/StoreKit.git
[submodule "Extensions/Bolts"]
	path = Extensions/Bolts
	url = https://github.com/PromiseKit/Bolts.git
[submodule "Extensions/CoreBluetooth"]
	path = Extensions/CoreBluetooth
	url = https://github.com/PromiseKit/CoreBluetooth.git
[submodule "Extensions/EventKit"]
	path = Extensions/EventKit
	url = https://github.com/PromiseKit/EventKit.git
[submodule "Extensions/SystemConfiguration"]
	path = Extensions/SystemConfiguration
	url = https://github.com/PromiseKit/SystemConfiguration
[submodule "Extensions/Alamofire"]
	path = Extensions/Alamofire
	url = https://github.com/PromiseKit/Alamofire
[submodule "Extensions/OMGHTTPURLRQ"]
	path = Extensions/OMGHTTPURLRQ
	url = https://github.com/PromiseKit/OMGHTTPURLRQ
[submodule "Extensions/AVFoundation"]
	path = Extensions/AVFoundation
	url = https://github.com/PromiseKit/AVFoundation
[submodule "Extensions/HomeKit"]
	path = Extensions/HomeKit
	url = https://github.com/PromiseKit/HomeKit.git
[submodule "Extensions/HealthKit"]
	path = Extensions/HealthKit
	url = https://github.com/PromiseKit/PMKHealthKit


================================================
FILE: .tidelift.yml
================================================
extra_ignore_directories: [ Tests ]


================================================
FILE: .travis.yml
================================================
os: osx
language: swift
osx_image: xcode9.4

if: tag =~ /^[0-9]+\.[0-9]+\.[0-9]+/

stages:
  - swiftpm
  - carthage

jobs:
  include:
    - &swiftpm
      stage: swiftpm
      osx_image: xcode9.4
      script: swift build
    - <<: *swiftpm
      osx_image: xcode10.3
    - <<: *swiftpm
      osx_image: xcode11.6

    - &carthage
      stage: carthage
      osx_image: xcode9.4
      install: sed -i '' "s/SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;/SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;/" *.xcodeproj/project.pbxproj
      script: carthage build --no-skip-current
    - <<: *carthage
      osx_image: xcode10.3
    - <<: *carthage
      osx_image: xcode11.6


================================================
FILE: Documentation/Appendix.md
================================================
# Common Misusage

## Doubling up Promises

Don’t do this:

```swift
func toggleNetworkSpinnerWithPromise<T>(funcToCall: () -> Promise<T>) -> Promise<T> {
    return Promise { seal in
        firstly {
            setNetworkActivityIndicatorVisible(true)
            return funcToCall()
        }.then { result in
            seal.fulfill(result)
        }.always {
            setNetworkActivityIndicatorVisible(false)
        }.catch { err in
            seal.reject(err)
        }
    }
}
```

Do this:

```swift
func toggleNetworkSpinnerWithPromise<T>(funcToCall: () -> Promise<T>) -> Promise<T> {
    return firstly {
        setNetworkActivityIndicatorVisible(true)
        return funcToCall()
    }.always {
        setNetworkActivityIndicatorVisible(false)
    }
}
```

You already *had* a promise, you don’t need to wrap it in another promise.


## Optionals in Promises

When we see `Promise<Item?>`, it usually implies a misuse of promises. For
example:

```swift
return firstly {
    getItems()
}.then { items -> Promise<[Item]?> in
    guard !items.isEmpty else {
        return .value(nil)
    }
    return Promise(value: items)
}
```

The second `then` chooses to return `nil` in some circumstances. This choice
imposes the need to check for `nil` on the consumer of the promise.

It's usually better to shunt these sorts of exceptions away from the
happy path and onto the error path. In this case, we can create a specific
error type for this condition:

```swift
return firstly {
    getItems()
}.map { items -> [Item]> in
    guard !items.isEmpty else {
        throw MyError.emptyItems
    }
    return items
}
```

> *Note*: Use `compactMap` when an API outside your control returns an Optional and you want to generate an error instead of propagating `nil`.

# Tips n’ Tricks

## Background-Loaded Member Variables

```swift
class MyViewController: UIViewController {
    private let ambience: Promise<AVAudioPlayer> = DispatchQueue.global().async(.promise) {
        guard let asset = NSDataAsset(name: "CreepyPad") else { throw PMKError.badInput }
        let player =  try AVAudioPlayer(data: asset.data)
        player.prepareToPlay()
        return player
    }
}
```

## Chaining Animations

```swift
firstly {
    UIView.animate(.promise, duration: 0.3) {
        self.button1.alpha = 0
    }
}.then {
    UIView.animate(.promise, duration: 0.3) {
        self.button2.alpha = 1
    }
}.then {
    UIView.animate(.promise, duration: 0.3) {
        adjustConstraints()
        self.view.layoutIfNeeded()
    }
}
```


## Voiding Promises

It is often convenient to erase the type of a promise to facilitate chaining.
For example, `UIView.animate(.promise)` returns `Guarantee<Bool>` because UIKit’s
completion API supplies a `Bool`. However, we usually don’t need this value and 
can chain more simply if it is discarded (that is, converted to `Void`). We can use
`asVoid()` to achieve this conversion:

```swift
UIView.animate(.promise, duration: 0.3) {
    self.button1.alpha = 0
}.asVoid().done(self.nextStep)
```

For situations in which we are combining many promises into a `when`, `asVoid()`
becomes essential:

```swift
let p1 = foo()
let p2 = bar()
let p3 = baz()
//…
let p10 = fluff()

when(fulfilled: p1.asVoid(), p2.asVoid(), /*…*/, p10.asVoid()).then {
    let value1 = p1.value!  // safe bang since all the promises fulfilled
    // …
    let value10 = p10.value!
}.catch {
    //…
}
```

You normally don't have to do this explicitly because `when` does it for you
for up to 5 parameters.


## Blocking (Await)

Sometimes you have to block the main thread to await completion of an asynchronous task.
In these cases, you can (with caution) use `wait`:

```swift
public extension UNUserNotificationCenter {
    var wasPushRequested: Bool {
        let settings = Guarantee(resolver: getNotificationSettings).wait()
        return settings != .notDetermined
    }
}
```

The task under the promise **must not** call back onto the current thread or it
will deadlock.

## Starting a Chain on a Background Queue/Thread

`firstly` deliberately does not take a queue. A detailed rationale for this choice
can be found in the ticket tracker.

So, if you want to start a chain by dispatching to the background, you have to use
`DispatchQueue.async`:

```swift
DispatchQueue.global().async(.promise) {
    return value  
}.done { value in
    //…
}
```

However, this function cannot return a promise because of Swift compiler ambiguity
issues. Thus, if you must start a promise on a background queue, you need to
do something like this:


```swift
Promise { seal in
    DispatchQueue.global().async {
        seal(value)
    }  
}.done { value in
    //…
}
```

Or more simply (though with caveats; see the documentation for `wait`):

```swift
DispatchQueue.global().async(.promise) {
    return try fetch().wait()
}.done { value in
    //…
}
```

However, you shouldn't need to do this often. If you find yourself wanting to use
this technique, perhaps you should instead modify the code for `fetch` to make it do
its work on a background thread.

Promises abstract asynchronicity, so exploit and support that model. Design your
APIs so that consumers don’t have to care what queue your functions run on.


================================================
FILE: Documentation/CommonPatterns.md
================================================
# Common Patterns

One feature of promises that makes them particularly useful is that they are composable.
This fact enables complex, yet safe asynchronous patterns that would otherwise be quite
intimidating when implemented with traditional methods.


## Chaining

The most common pattern is chaining:

```swift
firstly {
    fetch()
}.then {
    map($0)
}.then {
    set($0)
    return animate()
}.ensure {
    // something that should happen whatever the outcome
}.catch {
    handle(error: $0)
}
```

If you return a promise in a `then`, the next `then` *waits* on that promise
before continuing. This is the essence of promises.

Promises are easy to compose, so they encourage you to develop highly asynchronous
apps without fear of the spaghetti code (and associated refactoring pains) of
asynchronous systems that use completion handlers.


## APIs That Use Promises

Promises are composable, so return them instead of accepting completion blocks:

```swift
class MyRestAPI {
    func user() -> Promise<User> {
        return firstly {
            URLSession.shared.dataTask(.promise, with: url)
        }.compactMap {
            try JSONSerialization.jsonObject(with: $0.data) as? [String: Any]
        }.map { dict in
            User(dict: dict)
        }
    }

    func avatar() -> Promise<UIImage> {
        return user().then { user in
            URLSession.shared.dataTask(.promise, with: user.imageUrl)
        }.compactMap {
            UIImage(data: $0.data)
        }
    }
}
```

This way, asynchronous chains can cleanly and seamlessly incorporate code from all over
your app without violating architectural boundaries.

> *Note*: We provide [promises for Alamofire](https://github.com/PromiseKit/Alamofire-) too!


## Background Work

```swift
class MyRestAPI {
    func avatar() -> Promise<UIImage> {
        let bgq = DispatchQueue.global(qos: .userInitiated)

        return firstly {
            user()
        }.then(on: bgq) { user in
            URLSession.shared.dataTask(.promise, with: user.imageUrl)
        }.compactMap(on: bgq) {
            UIImage(data: $0)
        }
    }
}
```

All PromiseKit handlers take an `on` parameter that lets you designate the dispatch queue
on which to run the handler. The default is always the main queue.

PromiseKit is *entirely* thread safe.

> *Tip*: With caution, you can have all `then`, `map`, `compactMap`, etc., run on
a background queue. See `PromiseKit.conf`. Note that we suggest only changing
the queue for the `map` suite of functions, so `done` and `catch` will
continue to run on the main queue, which is *usually* what you want.

## Failing Chains

If an error occurs mid-chain, simply throw an error:

```swift
firstly {
    foo()
}.then { baz in
    bar(baz)
}.then { result in
    guard !result.isBad else { throw MyError.myIssue }
    //…
    return doOtherThing()
}
```

The error will surface at the next `catch` handler.

Since promises handle thrown errors, you don't have to wrap calls to throwing functions 
in a `do` block unless you really want to handle the errors locally:

```swift
foo().then { baz in
    bar(baz)
}.then { result in
    try doOtherThing()
}.catch { error in
    // if doOtherThing() throws, we end up here
}
```

> *Tip*: Swift lets you define an inline `enum Error` inside the function you
are working on. This isn’t *great* coding practice, but it's better than
avoiding throwing an error because you couldn't be bothered to define a good global
`Error` `enum`.


## Abstracting Away Asynchronicity

```swift
var fetch = API.fetch()

override func viewDidAppear() {
    fetch.then { items in
        //…
    }
}

func buttonPressed() {
    fetch.then { items in
        //…
    }
}

func refresh() -> Promise {
    // ensure only one fetch operation happens at a time

    if fetch.isResolved {
        startSpinner()
        fetch = API.fetch().ensure {
            stopSpinner()
        }
    }
    return fetch
}
```

With promises, you don’t need to worry about *when* your asynchronous operation
finishes. Just act like it already has.

Above, we see that you can call `then` as many times on a promise as you
like. All the blocks will be executed in the order they were added.


## Chaining Sequences

When you have a series of tasks to perform on an array of data:

```swift
// fade all visible table cells one by one in a “cascading” effect

var fade = Guarantee()
for cell in tableView.visibleCells {
    fade = fade.then {
        UIView.animate(.promise, duration: 0.1) {
            cell.alpha = 0
        }
    }
}
fade.done {
    // finish
}
```

Or if you have an array of closures that return promises:

```swift
var foo = Promise()
for nextPromise in arrayOfClosuresThatReturnPromises {
    foo = foo.then(nextPromise)
    // ^^ you rarely would want an array of promises instead, since then
    // they have all already started, you may as well use `when()`
}
foo.done {
    // finish
}
```

> *Note*: You *usually* want `when()`, since `when` executes all of its
component promises in parallel and so completes much faster. Use the pattern 
shown above in situations where tasks *must* be run sequentially; animation
is a good example.

> We also provide `when(concurrently:)`, which lets you schedule more than
one promise at a time if you need to.

## Timeout

```swift
let fetches: [Promise<T>] = makeFetches()
let timeout = after(seconds: 4)

race(when(fulfilled: fetches).asVoid(), timeout).then {
    //…
}
```

`race` continues as soon as one of the promises it is watching finishes.

Make sure the promises you pass to `race` are all of the same type. The easiest way
to ensure this is to use `asVoid()`.

Note that if any component promise rejects, the `race` will reject, too.


# Minimum Duration

Sometimes you need a task to take *at least* a certain amount of time. (For example,
you want to show a progress spinner, but if it shows for less than 0.3 seconds, the UI
appears broken to the user.)

```swift
let waitAtLeast = after(seconds: 0.3)

firstly {
    foo()
}.then {
    waitAtLeast
}.done {
    //…
}
```

The code above works because we create the delay *before* we do work in `foo()`. By the 
time we get to waiting on that promise, either it will have already timed out or we will wait
for whatever remains of the 0.3 seconds before continuing the chain.


## Cancellation

Promises don’t have a `cancel` function, but they do support cancellation through a
special error type that conforms to the `CancellableError` protocol.

```swift
func foo() -> (Promise<Void>, cancel: () -> Void) {
    let task = Task(…)
    var cancelme = false

    let promise = Promise<Void> { seal in
        task.completion = { value in
            guard !cancelme else { return reject(PMKError.cancelled) }
            seal.fulfill(value)
        }
        task.start()
    }

    let cancel = {
        cancelme = true
        task.cancel()
    }

    return (promise, cancel)
}
```

Promises don’t have a `cancel` function because you don’t want code outside of
your control to be able to cancel your operations--*unless*, of course, you explicitly
want to enable that behavior. In cases where you do want cancellation, the exact way 
that it should work will vary depending on how the underlying task supports cancellation.
PromiseKit provides cancellation primitives but no concrete API.

**Important**: Errors which conform to the `CancellableError` protocol do *not* normally trigger the `.catch` block. 
Cancelation is neither success nor failure, so cancelled chains do not call `catch` handlers by default. 
However you can intercept cancellation if you like:

```swift
foo.then {
    //…
}.catch(policy: .allErrors) {
    // cancelled errors are handled *as well*
}
```

**Important**: Canceling a promise chain is *not* the same as canceling the underlying
asynchronous task. Promises are wrappers around asynchronicity, but they have no
control over the underlying tasks. If you need to cancel an underlying task, you
need to cancel the underlying task!

> The library [CancellablePromiseKit](https://github.com/johannesd/CancellablePromiseKit) extends the concept of Promises to fully cover cancellable tasks.

## Retry / Polling

```swift
func attempt<T>(maximumRetryCount: Int = 3, delayBeforeRetry: DispatchTimeInterval = .seconds(2), _ body: @escaping () -> Promise<T>) -> Promise<T> {
    var attempts = 0
    func attempt() -> Promise<T> {
        attempts += 1
        return body().recover { error -> Promise<T> in
            guard attempts < maximumRetryCount else { throw error }
            return after(delayBeforeRetry).then(attempt)
        }
    }
    return attempt()
}

attempt(maximumRetryCount: 3) {
    flakeyTask(parameters: foo)
}.then {
    //…
}.catch { _ in
    // we attempted three times but still failed
}
```

In most cases, you should probably supplement the code above so that it re-attempts only for
specific error conditions.


## Wrapping Delegate Systems

Be careful with Promises and delegate systems, as they are not always compatible.
Promises complete *once*, whereas most delegate systems may notify their delegate many
times. This is why, for example, there is no PromiseKit extension for a
`UIButton`.

A good example of an appropriate time to wrap delegation is when you need a
single `CLLocation` lookup:

```swift
extension CLLocationManager {
    static func promise() -> Promise<CLLocation> {
        return PMKCLLocationManagerProxy().promise
    }
}

class PMKCLLocationManagerProxy: NSObject, CLLocationManagerDelegate {
    private let (promise, seal) = Promise<[CLLocation]>.pending()
    private var retainCycle: PMKCLLocationManagerProxy?
    private let manager = CLLocationManager()

    init() {
        super.init()
        retainCycle = self
        manager.delegate = self // does not retain hence the `retainCycle` property

        promise.ensure {
            // ensure we break the retain cycle
            self.retainCycle = nil
        }
    }

    @objc fileprivate func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        seal.fulfill(locations)
    }

    @objc func locationManager(_: CLLocationManager, didFailWithError error: Error) {
        seal.reject(error)
    }
}

// use:

CLLocationManager.promise().then { locations in
    //…
}.catch { error in
    //…
}
```

> Please note: we provide this promise with our CoreLocation extensions at
> https://github.com/PromiseKit/CoreLocation


## Recovery

Sometimes you don’t want an error to cascade. Instead, you want to supply a default result:

```swift
CLLocationManager.requestLocation().recover { error -> Promise<CLLocation> in
    guard error == MyError.airplaneMode else {
        throw error
    }
    return .value(CLLocation.savannah)
}.done { location in
    //…
}
```

Be careful not to ignore all errors, though! Recover only those errors that make sense to recover.


## Promises for Modal View Controllers

```swift
class ViewController: UIViewController {

    private let (promise, seal) = Guarantee<…>.pending()  // use Promise if your flow can fail

    func show(in: UIViewController) -> Promise<…> {
        in.show(self, sender: in)
        return promise
    }

    func done() {
        dismiss(animated: true)
        seal.fulfill(…)
    }
}

// use:

ViewController().show(in: self).done {
    //…
}.catch { error in
    //…
}
```

This is the best approach we have found, which is a pity as it requires the
presentee to control the presentation and requires the presentee to dismiss itself
explicitly.

Nothing seems to beat storyboard segues for decoupling an app's controllers.


## Saving Previous Results

Let’s say you have:


```swift
login().then { username in
    fetch(avatar: username)
}.done { image in
    //…
}
```

What if you want access to both `username` and `image` in your `done`?

The most obvious way is to use nesting:

```swift
login().then { username in
    fetch(avatar: username).done { image in
        // we have access to both `image` and `username`
    }
}.done {
    // the chain still continues as you'd expect
}
```

However, such nesting reduces the clarity of the chain. Instead, we could use Swift
tuples:

```swift
login().then { username in
    fetch(avatar: username).map { ($0, username) }
}.then { image, username in
    //…
}
```

The code above simply maps `Promise<String>` into `Promise<(UIImage, String)>`.


## Waiting on Multiple Promises, Whatever Their Result

Use `when(resolved:)`:

```swift
when(resolved: a, b).done { (results: [Result<T>]) in
    // `Result` is an enum of `.fulfilled` or `.rejected`
}

// ^^ cannot call `catch` as `when(resolved:)` returns a `Guarantee`
```

Generally, you don't want this! People ask for it a lot, but usually because
they are trying to ignore errors. What they really need is to use `recover` on one of the
promises. Errors happen, so they should be handled; you usually don't want to ignore them.


================================================
FILE: Documentation/Examples/ImageCache.md
================================================
# Image Cache with Promises

Here is an example of a simple image cache that uses promises to simplify the
state machine:

```swift
import Foundation
import PromiseKit

/**
 * Small (10 images)
 * Thread-safe
 * Consolidates multiple requests to the same URLs
 * Removes stale entries (FIXME well, strictly we may delete while fetching from cache, but this is unlikely and non-fatal)
 * Completely _ignores_ server caching headers!
 */

private let q = DispatchQueue(label: "org.promisekit.cache.image", attributes: .concurrent)
private var active: [URL: Promise<Data>] = [:]
private var cleanup = Promise()


public func fetch(image url: URL) -> Promise<Data> {
    var promise: Promise<Data>?
    q.sync {
        promise = active[url]
    }
    if let promise = promise {
        return promise
    }

    q.sync {
        promise = Promise(.start) {

            let dst = try url.cacheDestination()

            guard !FileManager.default.isReadableFile(atPath: dst.path) else {
                return Promise(dst)
            }

            return Promise { seal in
                URLSession.shared.downloadTask(with: url) { tmpurl, _, error in
                    do {
                        guard let tmpurl = tmpurl else { throw error ?? E.unexpectedError }
                        try FileManager.default.moveItem(at: tmpurl, to: dst)
                        seal.fulfill(dst)
                    } catch {
                        seal.reject(error)
                    }
                }.resume()
            }

        }.then(on: .global(QoS: .userInitiated)) {
            try Data(contentsOf: $0)
        }

        active[url] = promise

        if cleanup.isFulfilled {
            cleanup = promise!.asVoid().then(on: .global(QoS: .utility), execute: docleanup)
        }
    }

    return promise!
}

public func cached(image url: URL) -> Data? {
    guard let dst = try? url.cacheDestination() else {
        return nil
    }
    return try? Data(contentsOf: dst)
}


public func cache(destination remoteUrl: URL) throws -> URL {
    return try remoteUrl.cacheDestination()
}

private func cache() throws -> URL {
    guard let dst = FileManager.default.docs?
        .appendingPathComponent("Library")
        .appendingPathComponent("Caches")
        .appendingPathComponent("cache.img")
    else {
        throw E.unexpectedError
    }

    try FileManager.default.createDirectory(at: dst, withIntermediateDirectories: true, attributes: [:])

    return dst
}

private extension URL {
    func cacheDestination() throws -> URL {

        var fn = String(hashValue)
        let ext = pathExtension

        // many of Apple's functions don’t recognize file type
        // unless we preserve the file extension
        if !ext.isEmpty {
            fn += ".\(ext)"
        }

        return try cache().appendingPathComponent(fn)
    }
}

enum E: Error {
    case unexpectedError
    case noCreationTime
}

private func docleanup() throws {
    var contents = try FileManager.default
        .contentsOfDirectory(at: try cache(), includingPropertiesForKeys: [.creationDateKey])
        .map { url -> (Date, URL) in
            guard let date = try url.resourceValues(forKeys: [.creationDateKey]).creationDate else {
                throw E.noCreationTime
            }
            return (date, url)
        }.sorted(by: {
            $0.0 > $1.0
        })

    while contents.count > 10 {
        let rm = contents.popLast()!.1
        try FileManager.default.removeItem(at: rm)
    }
}
````

================================================
FILE: Documentation/Examples/URLSession+BadResponseErrors.swift
================================================
Promise(.pending) { seal in
    URLSession.shared.dataTask(with: rq, completionHandler: { data, rsp, error in
        if let data = data {
            seal.fulfill(data)
        } else if let error = error {
            if case URLError.badServerResponse = error, let rsp = rsp as? HTTPURLResponse {
                seal.reject(Error.badResponse(rsp.statusCode))
            } else {
                seal.reject(error)
            }
        } else {
            seal.reject(PMKError.invalidCallingConvention)
        }
    })
}

enum Error: Swift.Error {
    case badUrl
    case badResponse(Int)
}


================================================
FILE: Documentation/Examples/detweet.swift
================================================
#!/usr/bin/swift sh
import Foundation
import PromiseKit  // @mxcl ~> 6.5 
import Swifter     // @mattdonnelly == b27a89
let swifter = Swifter(
	consumerKey: "FILL",
	consumerSecret: "ME",
	oauthToken: "IN",
	oauthTokenSecret: "https://developer.twitter.com/en/docs/basics/apps/overview.html"
)

extension JSON {
    var date: Date? {
        guard let string = string else { return nil }

        let formatter = DateFormatter()
        formatter.dateFormat = "EEE MMM dd HH:mm:ss Z yyyy"
        return formatter.date(from: string)
    }
}

let twoMonthsAgo = Date() - 24*60*60*30*2

print("Deleting qualifying tweets before:", twoMonthsAgo)

func deleteTweets(maxID: String? = nil) -> Promise<Void> {
    return Promise { seal in
        swifter.getTimeline(for: "mxcl", count: 200, maxID: maxID, success: { json in

            if json.array!.count <= 1 {
                // if we get one result for a requested maxID, we're done
                return seal.fulfill()
            }

            for item in json.array! {
                let date = item["created_at"].date!
                guard date < twoMonthsAgo, item["favorite_count"].integer! < 2 else {
                    continue
                }
                swifter.destroyTweet(forID: id, success: { _ in
                    print("D:", item["text"].string!)
                }, failure: seal.reject)
            }

            let next = json.array!.last!["id_str"].string!
            deleteTweets(maxID: next).pipe(to: seal.resolve)

        }, failure: seal.reject)
    }
}

func deleteFavorites(maxID: String? = nil) -> Promise<Void> {
    return Promise { seal in
        swifter.getRecentlyFavoritedTweets(count: 200, maxID: maxID, success: { json in

            if json.array!.count <= 1 {
                return seal.fulfill()
            }

            for item in json.array! {
                guard item["created_at"].date! < twoMonthsAgo else { continue }

                swifter.unfavoriteTweet(forID: item["id_str"].string!, success: { _ in
                    print("D❤️:", item["text"].string!)
                }, failure: seal.reject)
            }
            
            let next = json.array!.last!["id_str"].string!
            deleteFavorites(maxID: next).pipe(to: seal.resolve)

        }, failure: seal.reject)
    }
}

func unblockPeople(cursor: String? = nil) -> Promise<Void> {
    return Promise { seal in
        swifter.getBlockedUsersIDs(stringifyIDs: "true", cursor: cursor, success: { json, prev, next in
            for id in json.array! {
                print("Unblocking:", id)
                swifter.unblockUser(for: .id(id.string!))
            }

            if let next = next, !next.isEmpty, next != prev, next != "0" {
                unblockPeople(cursor: next).pipe(to: seal.resolve)
            } else {
                seal.fulfill()
            }

        }, failure: seal.reject)
    }
}

firstly {
    when(fulfilled: deleteTweets(), deleteFavorites(), unblockPeople())
}.done {
    exit(0)
}.catch {
    print("error:", $0)
    exit(1)
}

RunLoop.main.run()


================================================
FILE: Documentation/FAQ.md
================================================
# FAQ

## Why should I use PromiseKit over X-Promises-Foo?

* PromiseKit has a heavy focus on **developer experience**. You’re a developer; do you care about your experience? Yes? Then pick PromiseKit.
* Do you care about having any bugs you find fixed? Then pick PromiseKit.
* Do you care about having your input heard and reacted to in a fast fashion? Then pick PromiseKit.
* Do you want a library that has been maintained continuously and passionately for 6 years? Then pick PromiseKit.
* Do you want a library that the community has chosen to be their №1 Promises/Futures library? Then pick PromiseKit.
* Do you want to be able to use Promises with Apple’s SDKs rather than having to do all the work of writing the Promise implementations yourself? Then pick PromiseKit.
* Do you want to be able to use Promises with Swift 3.x, Swift 4.x, ObjC, iOS, tvOS, watchOS, macOS, Android & Linux? Then pick PromiseKit.
* PromiseKit verifies its correctness by testing against the entire [Promises/A+ test suite](https://github.com/promises-aplus/promises-tests).

## How do I create a fulfilled `Void` promise?

```swift
let foo = Promise()

// or:

let bar = Promise.value(())
```

## How do I “early `return`”?

```swift
func foo() -> Promise<Void> {
   guard thingy else {
       return Promise()
   }

    //…
}

func bar() -> Promise<SomethingNotVoid> {
    guard thingy else {
        return .value(instanceOfSomethingNotVoid)
    }
    
    //…
}
```

## Do I need to worry about retain cycles?

Generally, no. Once a promise completes, all handlers are released and so
any references to `self` are also released.

However, if your chain contains side effects that you would typically
not want to happen after, say, a view controller is popped, then you should still
use `weak self` (and check for `self == nil`) to prevent any such side effects.

*However*, in our experience most things that developers consider side effects that
should be protected against are in fact *not* side effects.

Side effects include changes to global application state. They *do not* include
changing the display state of a view-controller. So, protect against setting `UserDefaults` or
modifying the application database, and don't bother protecting against changing
the text in a `UILabel`.

[This StackOverflow question](https://stackoverflow.com/questions/39281214/should-i-use-weak-self-in-promisekit-blocks)
has some good discussion on this topic.

## Do I need to retain my promises?

No. Every promise handler retains its promise until the handler is executed. Once
all handlers have been executed, the promise is deallocated. So you only need to retain
the promise if you need to refer to its final value after its chain has completed.

## Where should I put my `catch`?

`catch` deliberately terminates the chain. You should put it low in your promise
hierarchy at a point as close to the root as possible. Typically, this would be 
somewhere such as a view controller, where your `catch` can then display a message
to the user.

This means you should be writing one catch for many `then`s and returning
promises that do not have internal `catch` handlers of their own.

This is obviously a guideline; do what is necessary.

## How do branched chains work?

Suppose you have a promise:

```
let promise = foo()
```

And you call `then` twice:

```
promise.then {
    // branch A
}

promise.then {
    // branch B
}
```

You now have a branched chain. When `promise` resolves, both chains receive its
value. However, the two chains are entirely separate and Swift will prompt you
to ensure that both have `catch` handlers.

You can most likely ignore the `catch` for one of these branches, but be careful:
in these situations, Swift cannot help you ensure that your chains are error-handled.

```
promise.then {
    // branch A
}.catch { error in
    //…
}

_ = promise.then {
    print("foo")
    
    // ignoring errors here as print cannot error and we handle errors above
}
```

It may be safer to recombine the two branches into a single chain again:

```
let p1 = promise.then {
    // branch A
}

let p2 = promise.then {
    // branch B
}

when(fulfilled: p1, p2).catch { error in
    //…
}
```

> It's worth noting that you can add multiple `catch` handlers to a promise, too.
> And indeed, both will be called if the chain is rejected.

## Is PromiseKit “heavy”?

No. PromiseKit contains hardly any source code. In fact, it is quite lightweight. Any
“weight” relative to other promise implementations derives from 6 years of bug fixes
and tuning, from the fact that we have *stellar* Objective-C-to-Swift bridging and 
from important things such as [Zalgo prevention](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
that hobby-project implementations don’t consider.

## Why is debugging hard?

Because promises always execute via dispatch, the backtrace you see at the point of 
an error has less information than is usually required to trace the path of execution.

One solution is to turn off dispatch during debugging:

```swift
// Swift
DispatchQueue.default = zalgo

//ObjC
PMKSetDefaultDispatchQueue(zalgo)
```

Don’t leave this on. In normal use, we always dispatch to avoid you accidentally writing
a common bug pattern. See [this blog post](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony).

## Where is `all()`?

Some promise libraries provide `all` for awaiting multiple results. We call this function
`when`, but it is the same thing. We chose `when` because it's the more common term and
because we think it reads better in code.

## How can I test APIs that return promises?

You need to use `XCTestExpectation`.

We also define `wait()` and `hang()`. Use them if you must, but be careful because they
block the current thread!

## Is PromiseKit thread-safe?

Yes, entirely.

However the code *you* write in your `then`s might not be!

Just make sure you don’t access state outside the chain from concurrent queues.
By default, PromiseKit handlers run on the `main` thread, which is serial, so
you typically won't have to worry about this.

## Why are there separate classes for Objective-C and Swift?

`Promise<T>` is generic and and so cannot be represented by Objective-C.

## Does PromiseKit conform to Promises/A+?

Yes. We have tests that prove this.

## How do PromiseKit and RxSwift/ReactiveSwift differ?

PromiseKit is a lot simpler.

The top-level difference between PromiseKit and RxSwift is that RxSwift `Observable`s (roughly 
analogous to PromiseKit `Promise`s) do not necessarily return a single result: they may emit
zero, one, or an infinite stream of values. This small conceptual change leads to an API
that's both surprisingly powerful and surprisingly complex.

RxSwift requires commitment to a paradigm shift in how you program. It proposes that you
restructure your code as a matrix of interacting value pipelines. When applied properly
to a suitable problem, RxSwift can yield great benefits in robustness and simplicity.
But not all applications are suitable for RxSwift. 

By contrast, PromiseKit selectively applies the best parts of reactive programming
to the hardest part of pure Swift development, the management of asynchronicity. It's a broadly 
applicable tool. Most asynchronous code can be clarified, simplified and made more robust
just by converting it to use promises. (And the conversion process is easy.)

Promises make for code that is clear to most developers. RxSwift, perhaps not. Take a look at this 
[sign-up panel](https://github.com/ReactiveX/RxSwift/tree/master/RxExample/RxExample/Examples/GitHubSignup)
implemented in RxSwift and see what you think. (Note that this is one of RxSwift's own examples.)

Even where PromiseKit and RxSwift are broadly similar, there are many differences in implementation:

* RxSwift has a separate API for chain-terminating elements ("subscribers") versus interior
elements. In PromiseKit, all elements of a chain use roughly the same code pattern.

* The RxSwift API to define an interior element of a chain (an "operator") is hair-raisingly complex.
So, RxSwift tries hard to supply every operator you might ever want to use right off the shelf. There are
hundreds. PromiseKit supplies a few utilities to help with specific scenarios, but because it's trivial
to write your own chain elements, there's no need for all this extra code in the library.

* PromiseKit dispatches the execution of every block. RxSwift dispatches only when told to do so. Moreover, the 
current dispatching state is an attribute of the chain, not the specific block, as it is in PromiseKit.
The RxSwift system is more powerful but more complex. PromiseKit is simple, predictable and safe.

* In PromiseKit, both sides of a branched chain refer back to their shared common ancestors. In RxSwift, 
branching normally creates a duplicate parallel chain that reruns the code at the head of the chain...except 
when it doesn't. The rules for determining what will actually happen are complex, and given
a chain created by another chunk of code, you can't really tell what the behavior will be.

* Because RxSwift chains don't necessarily terminate on their own, RxSwift needs you to take on some
explicit garbage collection duties to ensure that pipelines that are no longer needed are properly
deallocated. All promises yield a single value, terminate and then automatically deallocate themselves.

You can find some additional discussion in [this ticket](https://github.com/mxcl/PromiseKit/issues/484).

## Why can’t I return from a catch like I can in JavaScript?

Swift demands that functions have one purpose. Thus, we have two error handlers:

* `catch`: ends the chain and handles errors
* `recover`: attempts to recover from errors in a chain

You want `recover`.

## When do promises “start”?

Often people are confused about when Promises “start”. Is it immediately? Is it
later? Is it when you call `then`?

The answer is: The promise **body** executes during initialization of the promise, on the current thread.
As an example, `"Executing the promise body"` will be printed to the console right after the promise is created,
without having to call `then` on the promise.

```swift
let testPromise = Promise<Bool> {
    print("Executing the promise body.")
    return $0.fulfill(true)
}
```

But what about asynchronous tasks that you create in your promise's body? They behave the same way as they would
without using PromiseKit. Here's a simple example:

```swift
let testPromise = Promise<Bool> { seal in
    print("Executing the promise body.")
    DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
        print("Executing asyncAfter.")
        return seal.fulfill(true)
    }
}
```

The message `"Executing the promise body."` is being logged right away, but the message `"Executing asyncAfter."`
is only logged three seconds later. In this case `DispatchQueue` is responsible for deciding when to execute
the task you pass to it, PromiseKit has nothing to do with it.

## What is a good way to use Firebase with PromiseKit

There is no good way to use Firebase with PromiseKit. See the next question for
a more detailed rationale.

The best option is to embed your chain in your Firebase handler:

```
foo.observe(.value) { snapshot in
    firstly {
        bar(with: snapshot)
    }.then {
        baz()
    }.then {
        baffle()
    }.catch {
        //…
    }
}
```


## I need my `then` to fire multiple times

Then we’re afraid you cannot use PromiseKit for that event. Promises only
resolve *once*. This is the fundamental nature of promises and it is considered a
feature because it gives you guarantees about the flow of your chains.


## How do I change the default queues that handlers run on?

You can change the values of `PromiseKit.conf.Q`. There are two variables that
change the default queues that the two kinds of handler run on. A typical
pattern is to change all your `then`-type handlers to run on a background queue
and to have all your “finalizers” run on the main queue:

```
PromiseKit.conf.Q.map = .global()
PromiseKit.conf.Q.return = .main  //NOTE this is the default
```

Be very careful about setting either of these queues to `nil`.  It has the
effect of running *immediately*, and this is not what you usually want to do in
your application.  This is, however, useful when you are running specs and want
your promises to resolve immediately. (This is basically the same idea as "stubbing"
an HTTP request.)

```swift
// in your test suite setup code
PromiseKit.conf.Q.map = nil
PromiseKit.conf.Q.return = nil
```

## How do I use PromiseKit on the server side?

If your server framework requires that the main queue remain unused (e.g., Kitura),
then you must use PromiseKit 6 and you must tell PromiseKit not to dispatch to the
main queue by default. This is easy enough:

```swift
PromiseKit.conf.Q = (map: DispatchQueue.global(), return: DispatchQueue.global())
```

> Note, we recommend using your own queue rather than `.global()`, we've seen better performance this way.

Here’s a more complete example:

```swift
import Foundation
import HeliumLogger
import Kitura
import LoggerAPI
import PromiseKit

HeliumLogger.use(.info)

let pmkQ = DispatchQueue(label: "pmkQ", qos: .default, attributes: .concurrent, autoreleaseFrequency: .workItem)
PromiseKit.conf.Q = (map: pmkQ, return: pmkQ)

let router = Router()
router.get("/") { _, response, next in
    Log.info("Request received")
    after(seconds: 1.0).done {
        Log.info("Sending response")
        response.send("OK")
        next()
    }
}

Log.info("Starting server")
Kitura.addHTTPServer(onPort: 8888, with: router)
Kitura.run()
```

## How do I control console output?

By default PromiseKit emits console messages when certain events occur.  These events include:
- A promise or guarantee has blocked the main thread
- A promise has been deallocated without being fulfilled
- An error which occurred while fulfilling a promise was swallowed using cauterize

You may turn off or redirect this output by setting a thread safe closure in [PMKConfiguration](https://github.com/mxcl/PromiseKit/blob/master/Sources/Configuration.swift) **before** processing any promises. For example, to turn off console output:

```swift
conf.logHandler = { event in }
```

## My question was not answered

[Please open a ticket](https://github.com/mxcl/PromiseKit/issues/new).


================================================
FILE: Documentation/GettingStarted.md
================================================
# `then` and `done`

Here is a typical promise chain:

```swift
firstly {
    login()
}.then { creds in
    fetch(avatar: creds.user)
}.done { image in
    self.imageView = image
}
```

If this code used completion handlers, it would look like this:

```swift
login { creds, error in
    if let creds = creds {
        fetch(avatar: creds.user) { image, error in
            if let image = image {
                self.imageView = image
            }
        }
    }
}
```

`then` *is* just another way to structure completion handlers, but it is also quite a
bit more. At this initial stage of our understanding, it mostly helps
readability. The promise chain above is easy to scan and understand: one asynchronous
operation leads into the other, line by line. It's as close to
procedural code as we can easily come given the current state of Swift.

`done` is the same as `then` but you cannot return a promise. It is 
typically the end of the “success” part of the chain. Above, you can see that we
receive the final image in our `done` and use it to set up the UI.

Let’s compare the signatures of the two login methods:

```swift
func login() -> Promise<Creds>
    
// Compared with:

func login(completion: (Creds?, Error?) -> Void)
                        // ^^ ugh. Optionals. Double optionals.
```

The distinction is that with promises, your functions return *promises* instead 
of accepting and running callbacks. Each handler in a chain returns a promise. 
`Promise` objects define the `then` method, which waits for the completion of the
promise before continuing the chain. Chains resolve procedurally, one promise
at a time.

A `Promise` represents the future value of an asynchronous task. It has a type
that represents the type of object it wraps. For example, in the example above,
`login` is a function that returns a `Promise` that *will* represent an instance
of `Creds`.

> *Note*: `done` is new to PromiseKit 5. We previously defined a variant of `then` that
did not require you to return a promise. Unfortunately, this convention often confused
Swift and led to odd and hard-to-debug error messages. It also made using PromiseKit 
more painful. The introduction of `done` lets you type out promise chains that
compile without additional qualification to help the compiler figure out type information.

---

You may notice that unlike the completion pattern, the promise chain appears to
ignore errors. This is not the case! In fact, it has the opposite effect: the promise
chain makes error handling more accessible and makes errors harder to ignore.


# `catch`

With promises, errors cascade along the promise chain, ensuring that your apps are
robust and your code is clear:

```swift
firstly {
    login()
}.then { creds in
    fetch(avatar: creds.user)
}.done { image in
    self.imageView = image
}.catch {
    // any errors in the whole chain land here
}
```

> Swift emits a warning if you forget to `catch` a chain. But we'll
> talk about that in more detail later.

Each promise is an object that represents an individual, asynchronous task.
If a task fails, its promise becomes *rejected*. Chains that contain rejected
promises skip all subsequent `then`s. Instead, the next `catch` is executed.
(Strictly speaking, *all* subsequent `catch` handlers are executed.)

For fun, let’s compare this pattern with its completion handler equivalent:

```swift
func handle(error: Error) {
    //…
}

login { creds, error in
    guard let creds = creds else { return handle(error: error!) }
    fetch(avatar: creds.user) { image, error in
        guard let image = image else { return handle(error: error!) }
        self.imageView.image = image
    }
}
```

The use of `guard` and a consolidated error handler help, but the promise chain’s
readability speaks for itself.


# `ensure`

We have learned to compose asynchronicity. Next let’s extend our primitives:

```swift
firstly {
    UIApplication.shared.isNetworkActivityIndicatorVisible = true
    return login()
}.then {
    fetch(avatar: $0.user)
}.done {
    self.imageView = $0
}.ensure {
    UIApplication.shared.isNetworkActivityIndicatorVisible = false
}.catch {
    //…
}
```

No matter the outcome of your chain—-failure or success—-your `ensure`
handler is always called.

Let’s compare this pattern with its completion handler equivalent:

```swift
UIApplication.shared.isNetworkActivityIndicatorVisible = true

func handle(error: Error) {
    UIApplication.shared.isNetworkActivityIndicatorVisible = false
    //…
}

login { creds, error in
    guard let creds = creds else { return handle(error: error!) }
    fetch(avatar: creds.user) { image, error in
        guard let image = image else { return handle(error: error!) }
        self.imageView.image = image
        UIApplication.shared.isNetworkActivityIndicatorVisible = false
    }
}
```

It would be very easy for someone to amend this code and forget to unset 
the activity indicator, leading to a bug. With promises, this type of error is
almost impossible: the Swift compiler resists your supplementing the chain without 
using promises. You almost won’t need to review the pull requests.

> *Note*: PromiseKit has perhaps capriciously switched between the names `always`
and `ensure` for this function several times in the past. Sorry about this. We suck.

You can also use `finally` as an `ensure` that terminates the promise chain and does not return a value:

```
spinner(visible: true)

firstly {
    foo()
}.done {
    //…
}.catch {
    //…
}.finally {
    self.spinner(visible: false)
}
```


# `when`

With completion handlers, reacting to multiple asynchronous operations is either
slow or hard. Slow means doing it serially:

```swift
operation1 { result1 in
    operation2 { result2 in
        finish(result1, result2)
    }
}
```

The fast (*parallel*) path code makes the code less clear:

```swift
var result1: …!
var result2: …!
let group = DispatchGroup()
group.enter()
group.enter()
operation1 {
    result1 = $0
    group.leave()
}
operation2 {
    result2 = $0
    group.leave()
}
group.notify(queue: .main) {
    finish(result1, result2)
}
```

Promises are easier:

```swift
firstly {
    when(fulfilled: operation1(), operation2())
}.done { result1, result2 in
    //…
}
```

`when` takes promises, waits for them to resolve and returns a promise containing the results.

As with any promise chain, if any of the component promises fail, the chain calls the next `catch`.


# PromiseKit Extensions

When we made PromiseKit, we understood that we wanted to use *only* promises to implement 
asynchronous behavior. So wherever possible, we offer extensions to Apple’s APIs that reframe
the API in terms of promises. For example:

```swift
firstly {
    CLLocationManager.promise()
}.then { location in
    CLGeocoder.reverseGeocode(location)
}.done { placemarks in
    self.placemark.text = "\(placemarks.first)"
}
```

To use these extensions, you need to specify subspecs:

```ruby
pod "PromiseKit"
pod "PromiseKit/CoreLocation"
pod "PromiseKit/MapKit"
```

All of these extensions are available at the [PromiseKit organization](https://github.com/PromiseKit).
Go there to see what's available and to read the source code and documentation. Every file and function
has been copiously documented.

> We also provide extensions for common libraries such as [Alamofire](https://github.com/PromiseKit/Alamofire-).


# Making Promises

The standard extensions will take you a long way, but sometimes you'll still need to start chains
of your own. Maybe you're using a third party API that doesn’t provide promises, or perhaps you wrote
your own asynchronous system. Either way, it's easy to add promises. If you look at the code of the
standard extensions, you'll see that it uses the same approach  described below.

Let’s say we have the following method:

```swift
func fetch(completion: (String?, Error?) -> Void)
```

How do we convert this to a promise? Well, it's easy:

```swift
func fetch() -> Promise<String> {
    return Promise { fetch(completion: $0.resolve) }
}
```

You may find the expanded version more readable:

```swift
func fetch() -> Promise<String> {
    return Promise { seal in
        fetch { result, error in
            seal.resolve(result, error)
        }
    }
}
```

The `seal` object that the `Promise` initializer provides to you defines 
many methods for handling garden-variety completion handlers. It even 
covers a variety of rarer situations, thus making it easy for you to add 
promises to an existing codebase.

> *Note*: We tried to make it so that you could just do `Promise(fetch)`, but we
were not able to make this simpler pattern work universally without requiring
extra disambiguation for the Swift compiler. Sorry; we tried.

> *Note*: In PMK 4, this initializer provided two parameters to your closure:
`fulfill` and `reject`. PMK 5 and 6 give you an object that has both `fulfill` and
`reject` methods, but also many variants of the method `resolve`. You can
typically just pass completion handler parameters to `resolve` and let Swift figure
out which variant to apply to your particular case (as shown in the example above).

> *Note* `Guarantees` (below) have a slightly different initializer (since they
cannot error) so the parameter to the initializer closure is just a closure. Not
a `Resolver` object. Thus do `seal(value)` rather than `seal.fulfill(value)`. This
is because there is no variations in what guarantees can be sealed with, they can
*only* fulfill.

# `Guarantee<T>`

Since PromiseKit 5, we have provided `Guarantee` as a supplementary class to
`Promise`. We do this to complement Swift’s strong error handling system.

Guarantees *never* fail, so they cannot be rejected. A good example is `after`:

```
firstly {
    after(seconds: 0.1)
}.done {
    // there is no way to add a `catch` because after cannot fail.
}
```

Swift warns you if you don’t terminate a regular `Promise` chain (i.e., not
a `Guarantee` chain). You're expected to silence this warning by supplying 
either a `catch` or a `return`. (In the latter case, you will then have to `catch` 
at the point where you receive that promise.)

Use `Guarantee`s wherever possible so that your code has error handling where
it's required and no error handling where it's not required.

In general, you should be able to use `Guarantee`s and `Promise`s interchangeably,
We have gone to great lengths to try and ensure this, so please open a ticket
if you find an issue.

---

If you are creating your own guarantees the syntax is simpler than that of promises;

```swift
func fetch() -> Promise<String> {
    return Guarantee { seal in
        fetch { result in
            seal(result)
        }
    }
}
```

Which could be reduced to:

```swift
func fetch() -> Promise<String> {
    return Guarantee(resolver: fetch)
}
```

# `map`, `compactMap`, etc.

`then` provides you with the result of the previous promise and requires you to return
another promise.

`map` provides you with the result of the previous promise and requires you to return
an object or value type.

`compactMap` provides you with the result of the previous promise and requires you
to return an `Optional`. If you return `nil`, the chain fails with
`PMKError.compactMap`.

> *Rationale*: Before PromiseKit 4, `then` handled all these cases, and it was
painful. We hoped the pain would disappear with new Swift versions. However,
it has become clear that the various pain points are here to stay. In fact, we
as library authors are expected to disambiguate at the naming level of our API.
Therefore, we have split the three main kinds of `then` into `then`, `map` and
`done`. After using these new functions, we realized this is much nicer in practice,
so we added `compactMap` as well (modeled on `Optional.compactMap`).

`compactMap` facilitates quick composition of promise chains. For example:

```swift
firstly {
    URLSession.shared.dataTask(.promise, with: rq)
}.compactMap {
    try JSONSerialization.jsonObject($0.data) as? [String]
}.done { arrayOfStrings in
    //…
}.catch { error in
    // Foundation.JSONError if JSON was badly formed
    // PMKError.compactMap if JSON was of different type
}
```

> *Tip*: We also provide most of the functional methods you would expect for sequences,
e.g., `map`, `thenMap`, `compactMapValues`, `firstValue`, etc.


# `get`

We provide `get` as a `done` that returns the value fed to `get`.

```swift
firstly {
    foo()
}.get { foo in
    //…
}.done { foo in
    // same foo!
}
```


# `tap`

We provide `tap` for debugging. It's the same as `get` but provides the
`Result<T>` of the `Promise` so you can inspect the value of the chain at this
point without causing any side effects:

```swift
firstly {
    foo()
}.tap {
    print($0)
}.done {
    //…
}.catch {
    //…
}
```


# Supplement

## `firstly`

We've used `firstly` several times on this page, but what is it, really? In fact,
it is just [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar).
You don’t really need it, but it helps to make your chains more readable. Instead of:

```swift
firstly {
    login()
}.then { creds in
    //…
}
```

You could just do:

```swift
login().then { creds in
    //…
}
```

Here is a key understanding: `login()` returns a `Promise`, and all `Promise`s have a `then` function. `firstly` returns a `Promise`, and `then` returns a `Promise`, too! But don’t worry too much about these details. Learn the *patterns* to start with. Then, when you are ready to advance, learn the underlying architecture.


## `when` Variants

`when` is one of PromiseKit’s more useful functions, and so we offer several variants.

* The default `when`, and the one you should typically use, is `when(fulfilled:)`. This variant
waits on all its component promises, but if any fail, `when` fails too, and thus the chain *rejects*. 
It's important to note that all promises in the `when` *continue*. Promises have *no* control over
the tasks they represent. Promises are just wrappers around tasks.

* `when(resolved:)` waits even if one or more of its component promises fails. The value produced
by this variant of `when` is an array of `Result<T>`. Consequently, this variant requires all its 
component promises to have the same generic type. See our advanced patterns guide for work-arounds
for this limitation.

* The `race` variant lets you *race* several promises. Whichever finishes first is the result. See the
advanced patterns guide for typical usage.


## Swift Closure Inference

Swift automatically infers returns and return types for one-line closures.
The following two forms are the same:

```swift
foo.then {
    bar($0)
}

// is the same as:

foo.then { baz -> Promise<String> in
    return bar(baz)
}
```

Our documentation often omits the `return` for clarity.

However, this shorthand is both a blessing and a curse. You may find that the Swift compiler
often fails to infer return types properly. See our [Troubleshooting Guide](Troubleshooting.md) if
you require further assistance.

> By adding `done` to PromiseKit 5, we have managed to avoid many of these common
pain points in using PromiseKit and Swift.



# Further Reading

The above information is the 90% you will use. We **strongly** suggest reading the
[API Reference].
There are numerous little
functions that may be useful to you, and the documentation for everything outlined above
is more thorough at the source.

In Xcode, don’t forget to option-click on PromiseKit functions to access this
documentation while you're coding.

Here are some recent articles that document PromiseKit 5+:

* [Using Promises - Agostini.tech](https://agostini.tech/2018/10/08/using-promisekit)

Careful with general online references, many of them refer to PMK < 5 which has a subtly
different API (sorry about that, but Swift has changed a lot over the years and thus
we had to too).


[API Reference]: https://mxcl.dev/PromiseKit/reference/v6/Classes/Promise.html


================================================
FILE: Documentation/Installation.md
================================================
# Xcode 8.3, 9.x or 10.x / Swift 3 or 4

We recommend Carthage over CocoaPods, but both installation methods are supported.

## CocoaPods

```ruby
use_frameworks!

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

If the generated Xcode project gives you a warning that PromiseKit needs to be upgraded to
Swift 4.0 or Swift 4.2, then add the following:

```ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'PromiseKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end
```

Adjust the value for `SWIFT_VERSION` as needed.

CocoaPods are aware of this [issue](https://github.com/CocoaPods/CocoaPods/issues/7134).

## Carthage

```ruby
github "mxcl/PromiseKit" ~> 6.8
```

> Please note, since PromiseKit 6.8.1 our Carthage support has transitioned to
> Swift 4 and above only. Strictly we *do* still support Swift 3.1 for Carthage,
> and if you like you could edit the PromiseKit `project.pbxproj` file during
> `carthage bootstrap` to make this possible. This change was involuntary and due
> to Xcode 10.2 dropping support for Swift 3.

From Xcode 12, you will likely need to build using `--use-xcframeworks`, eg:

    carthage build --use-xcframeworks

## Accio

Add the following to your Package.swift:

```swift
.package(url: "https://github.com/mxcl/PromiseKit.git", .upToNextMajor(from: "6.8.4")),
```

Next, add `PromiseKit` to your App targets dependencies like so:

```swift
.target(
    name: "App",
    dependencies: [
        "PromiseKit",
    ]
),
```

Then run `accio update`.

## SwiftPM

```swift
package.dependencies.append(
    .package(url: "https://github.com/mxcl/PromiseKit", from: "6.8.0")
)
```

## Manually

You can just drop `PromiseKit.xcodeproj` into your project and then add
`PromiseKit.framework` to your app’s embedded frameworks.


# PromiseKit vs. Xcode

PromiseKit contains Swift, so there have been rev-lock issues with Xcode:

| PromiseKit | Swift                   | Xcode    |   CI Status  |   Release Notes   |
| ---------- | ----------------------- | -------- | ------------ | ----------------- |
|      6     |      3.2, 3.3, 4.x, 5.x | 8.3, 9.x, 10.x | ![ci-master] | [2018/02][news-6] |
|      5     | 3.1, 3.2, 3.3, 4.x      | 8.3, 9.x, 10.1 | *Deprecated* |       *n/a*       |
|      4     | 3.0, 3.1, 3.2, 3.3, 4.x | 8.x, 9.x, 10.1 | ![ci-master] | [2016/09][news-4] |
|      3     | 2.x                     | 7.x, 8.0 | ![ci-swift2] | [2015/10][news-3] |
|      2     | 1.x                     | 7.x      | *Deprecated* | [2015/10][news-3] |
|      1†    | *N/A*                   | *        | ![ci-legacy] |         –         |

† PromiseKit 1 is pure Objective-C and thus can be used with any Xcode, it is
also your only choice if you need to support iOS 7 or below.

---

We also maintain a series of branches to aid migration for PromiseKit 2:

| Xcode | Swift | PromiseKit | Branch                      | CI Status |
| ----- | ----- | -----------| --------------------------- | --------- |
|  8.0  |  2.3  | 2          | [swift-2.3-minimal-changes] | ![ci-23]  |
|  7.3  |  2.2  | 2          | [swift-2.2-minimal-changes] | ![ci-22]  |
|  7.2  |  2.2  | 2          | [swift-2.2-minimal-changes] | ![ci-22]  |
|  7.1  |  2.1  | 2          | [swift-2.0-minimal-changes] | ![ci-20]  |
|  7.0  |  2.0  | 2          | [swift-2.0-minimal-changes] | ![ci-20]  |

We do **not** usually backport fixes to these branches, but pull requests are welcome.


## Xcode 8 / Swift 2.3 or Xcode 7

```ruby
# CocoaPods
swift_version = "2.3"
pod "PromiseKit", "~> 3.5"

# Carthage
github "mxcl/PromiseKit" ~> 3.5
```


[travis]: https://travis-ci.org/mxcl/PromiseKit
[ci-master]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=master
[ci-legacy]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=legacy-1.x
[ci-swift2]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.x
[ci-23]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.3-minimal-changes
[ci-22]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.2-minimal-changes
[ci-20]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=swift-2.0-minimal-changes
[news-2]: http://mxcl.dev/PromiseKit/news/2015/05/PromiseKit-2.0-Released/
[news-3]: https://github.com/mxcl/PromiseKit/blob/212f31f41864d1e3ec54f5dd529bd8e1e5697024/CHANGELOG.markdown#300-oct-1st-2015
[news-4]: http://mxcl.dev/PromiseKit/news/2016/09/PromiseKit-4.0-Released/
[news-6]: http://mxcl.dev/PromiseKit/news/2018/02/PromiseKit-6.0-Released/
[swift-2.3-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.3-minimal-changes
[swift-2.2-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.2-minimal-changes
[swift-2.0-minimal-changes]: https://github.com/mxcl/PromiseKit/tree/swift-2.0-minimal-changes


# Using Git Submodules for PromiseKit’s Extensions

> *Note*: This is a more advanced technique.

If you use CocoaPods and a few PromiseKit extensions, then importing PromiseKit
causes that module to import all the extension frameworks. Thus, if you have an
app and a few app extensions (e.g., iOS app, iOS watch extension, iOS Today
extension) then all your final products that use PromiseKit will have forced
dependencies on all the Apple frameworks that PromiseKit provides extensions
for.

This isn’t that bad, but every framework that loads entails overhead and
lengthens startup time.

It’s both better and worse with Carthage. We build individual micro-frameworks
for each PromiseKit extension, so your final products link
against only the Apple frameworks that they actually need. However, Apple has
advised that apps link only against “about 12” frameworks for performance
reasons. So with Carthage, we are worse off on this metric.

The solution is to instead import only CorePromise:

```ruby
# CocoaPods
pod "PromiseKit/CorePromise"

# Carthage
github "mxcl/PromiseKit"
# ^^ for Carthage *only* have this
```

And to use the extensions you need via `git submodules`:

```
git submodule init
git submodule add https://github.com/PromiseKit/UIKit Submodules/PMKUIKit
```

Then in Xcode you can add these sources to your targets on a per-target basis.

Then when you `pod update`, ensure that you also update your submodules:

    pod update && git submodule update --recursive --remote



# Release History

## [6.0](https://github.com/mxcl/PromiseKit/releases/tag/6.0.0) Feb 13th, 2018

* [PromiseKit 6 announcement post][news-6].

## [4.0](https://github.com/mxcl/PromiseKit/releases/tag/4.0.0)

* [PromiseKit 4 announcement post][news-4].

## [3.0](https://github.com/mxcl/PromiseKit/releases/tag/3.0.0) Oct 1st, 2015

In Swift 2.0 `catch` and `defer` became reserved keywords mandating we rename
our functions with these names. This forced a major semantic version change on
PromiseKit and thus we took the opportunity to make other minor (source
compatibility breaking) improvements.

Thus if you cannot afford to adapt to PromiseKit 3 but still want to use
Xcode-7.0/Swift-2.0 we provide a [minimal changes branch] where `catch` and
`defer` are renamed `catch_` and `defer_` and all other changes are the bare
minimum to make PromiseKit 2 compile against Swift 2.

If you still are using Xcode 6 and Swift 1.2 then use PromiseKit 2.

[minimal changes branch]: https://github.com/mxcl/PromiseKit/tree/swift-2.0-minimal-changes

## [2.0](https://github.com/mxcl/PromiseKit/releases/tag/2.0.0) May 14th, 2015

[PromiseKit 2 announcement post](http://mxcl.dev/PromiseKit/news/2015/05/PromiseKit-2.0-Released/).

## [1.5](https://github.com/mxcl/PromiseKit/releases/tag/1.5.0)

Swift 1.2 support. Xcode 6.3 required.


================================================
FILE: Documentation/ObjectiveC.md
================================================
# Objective-C

PromiseKit has two promise classes:

* `Promise<T>` (Swift)
* `AnyPromise` (Objective-C)

Each is designed to be an appropriate promise implementation for the strong points of its language:

* `Promise<T>` is strict, defined and precise.
* `AnyPromise` is loose and dynamic.

Unlike most libraries, we have extensive bridging support, you can use PromiseKit
in mixed projects with mixed language targets and mixed language libraries.


# Using PromiseKit with Objective-C

`AnyPromise` is our promise class for Objective-C. It behaves almost identically to `Promise<T>`, our Swift promise class.

```objc
myPromise.then(^(NSString *bar){
    return anotherPromise;
}).then(^{
    //…
}).catch(^(NSError *error){
    //…
});
```

You make new promises using `promiseWithResolverBlock`:

```objc
- (AnyPromise *)myPromise {
    return [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve){
        resolve(foo);  // if foo is an NSError, rejects, else, resolves
    }];
}
```

---

You reject promises by throwing errors:

```objc
myPromise.then(^{
    @throw [NSError errorWithDomain:domain code:code userInfo:nil];
}).catch(^(NSError *error){
    //…
});
```

One important feature is the syntactic flexibility of your handlers:

```objc
myPromise.then(^{
    // no parameters is fine
});

myPromise.then(^(id foo){
    // one parameter is fine
});

myPromise.then(^(id a, id b, id c){
    // up to three parameter is fine, no crash!
});

myPromise.then(^{
    return @1; // return anything or nothing, it's fine, no crash
});
```

We do runtime inspection of the block you pass to achieve this magic.

---

Another important distinction is that the equivalent function to Swift’s `recover` is combined with `AnyPromise`’s `catch`. This is typical to other “dynamic” promise implementations and thus achieves our goal that `AnyPromise` is loose and dynamic while `Promise<T>` is strict and specific.

A sometimes unexpected consequence of this fact is that returning nothing from a `catch` *resolves* the returned promise:

```objc
myPromise.catch(^{
    [UIAlertView …];
}).then(^{
    // always executes!
});
```

---

Another important distinction is that the `value` property returns even if the promise is rejected; in that case, it returns the `NSError` object with which the promise was rejected.


# Bridging Between Objective-C & Swift

Let’s say you have:

```objc
@interface Foo
- (AnyPromise *)myPromise;
@end
```

Ensure that this interface is included in your bridging header. You can now use the 
following pattern in your Swift code:

```swift
let foo = Foo()
foo.myPromise.then { (obj: AnyObject?) -> Int in
    // it is not necessary to specify the type of `obj`
    // we just do that for demonstrative purposes
}
```

---

Let’s say you have:

```swift
@objc class Foo: NSObject {
    func stringPromise() -> Promise<String>    
    func barPromise() -> Promise<Bar>
}

@objc class Bar: NSObject { /*…*/ }
```

Ensure that your project is generating a `…-Swift.h` header so that Objective-C can see your Swift code.

If you built this project and opened the `…-Swift.h` header, you would only see this:

```objc
@interface Foo
@end

@interface Bar
@end
```

That's because Objective-C cannot import Swift objects that are generic. So we need to write some stubs:

```swift
@objc class Foo: NSObject {
    @objc func stringPromise() -> AnyPromise {
        return AnyPromise(stringPromise())
    }
    @objc func barPromise() -> AnyPromise {
        return AnyPromise(barPromise())
    }
}
```

If we built this and opened our generated header, we would now see:

```objc
@interface Foo
- (AnyPromise *)stringPromise;
- (AnyPromise *)barPromise;
@end

@interface Bar
@end
```

Perfect.

Note that AnyPromise can only bridge objects that conform to `AnyObject` or derive from `NSObject`. This is a limitation of Objective-C.

# Using ObjC AnyPromises from Swift

Simply use them, the type of your handler parameter is `Any`:

```objective-c
- (AnyPromise *)fetchThings {
    return [AnyPromise promiseWithValue:@[@"a", @"b", @"c"]];
}
```

Since ObjC is not type-safe and Swift is, you will (probably) need to cast the `Any` to whatever it is you actually are feeding:

```swift
Foo.fetchThings().done { any in
    let bar = any as! [String]
}
```

## :warning: Caution:

ARC in Objective-C, unlike in Objective-C++, is not exception-safe by default.
So, throwing an error will result in keeping a strong reference to the closure 
that contains the throw statement.
This pattern will consequently result in memory leaks if you're not careful.

> *Note:* Only having a strong reference to the closure would result in memory leaks.
> In our case, PromiseKit automatically keeps a strong reference to the closure until it's released.

__Workarounds:__

1. Return a Promise with value NSError\
Instead of throwing a normal error, you can return a Promise with value NSError instead.

```objc
myPromise.then(^{
    return [AnyPromise promiseWithValue:[NSError myCustomError]];
}).catch(^(NSError *error){
    if ([error isEqual:[NSError myCustomError]]) {
        // In case, same error as the one we thrown
        return;
    }
    //…
});
```
2. Enable ARC for exceptions in Objective-C (not recommended)\
You can add this  ```-fobjc-arc-exceptions to your``` to your compiler flags to enable ARC for exceptions.
This is not recommended unless you've read the Apple documentation and are comfortable with the caveats.

For more details on ARC and exceptions:
https://clang.llvm.org/docs/AutomaticReferenceCounting.html#exceptions



================================================
FILE: Documentation/README.md
================================================
# Contents

* [README](../README.md)
* Handbook
  * [Getting Started](GettingStarted.md)
  * [Promises: Common Patterns](CommonPatterns.md)
  * [Frequently Asked Questions](FAQ.md)
* Manual
  * [Installation Guide](Installation.md)
  * [Objective-C Guide](ObjectiveC.md)
  * [Troubleshooting](Troubleshooting.md)
  * [Appendix](Appendix.md)
* [Examples](Examples)
* [API Reference](https://mxcl.dev/PromiseKit/reference/v6/Classes/Promise.html)


================================================
FILE: Documentation/Troubleshooting.md
================================================
# Troubleshooting

## Compilation errors

99% of compilation issues involving PromiseKit can be addressed or diagnosed by one of the fixes below.

### Check your handler

```swift
return firstly {
      URLSession.shared.dataTask(.promise, with: url)
}.compactMap {
    JSONSerialization.jsonObject(with: $0.data) as? [String: Any]
}.then { dict in
    User(dict: dict)
}
```

Swift (unhelpfully) says:

> Cannot convert value of type '([String : Any]) -> User' to expected argument type '([String : Any]) -> _'

What’s the real problem? `then` *must* return a `Promise`, and you're trying to return something else. What you really want is `map`:

```swift
return firstly {
      URLSession.shared.dataTask(.promise, with: url)
}.compactMap {
    JSONSerialization.jsonObject(with: $0.data) as? [String: Any]
}.map { dict in
    User(dict: dict)
}
```

### Specify closure parameters **and** return type

For example:

```swift
return firstly {
    foo()
}.then { user in
    //…
    return bar()
}
```

This code may compile if you specify the type of `user`:


```swift
return firstly {
    foo()
}.then { (user: User) in
    //…
    return bar()
}
```

If it still doesn't compile, perhaps you need to specify the return type, too:

```swift
return firstly {
    foo()
}.then { (user: User) -> Promise<Bar> in
    //…
    return bar()
}
```

We have made great effort to reduce the need for explicit typing in PromiseKit 6, 
but as with all Swift functions that return a generic type (e.g., `Array.map`),
you may need to explicitly tell Swift what a closure returns if the closure's body is
longer than one line.

> *Tip*: Sometimes you can force a one-liner by using semicolons.


### Acknowledge all incoming closure parameters

Swift does not permit you to silently ignore a closure's parameters. For example, this code:

```swift
func _() -> Promise<Void> {
    return firstly {
        proc.launch(.promise)      // proc: Foundation.Process
    }.then {
        when(fulfilled: p1, p2)    // both p1 & p2 are `Promise<Void>`
    }
}
```

Fails to compile with the error:

    Cannot invoke 'then' with an argument list of type '(() -> _)
  
What's the problem? Well, `Process.launch(.promise)` returns
`Promise<(String, String)>`, and we are ignoring this value in our `then` closure. 
If we’d referenced `$0` or named the parameter, Swift would have been satisfied.

Assuming that we really do want to ignore the argument, the fix is to explicitly
acknowledge its existence by assigning it the name "_". That's Swift-ese for "I
know there's a value here, but I'm ignoring it."


```swift
func _() -> Promise<Void> {
    return firstly {
        proc.launch(.promise)
    }.then { _ in
        when(fulfilled: p1, p2)
    }
}
```

In this situation, you won't always receive an error message that's as clear as the
one shown above. Sometimes, a missing closure parameter sends Swift scurrying off
into type inference limbo. When it finally concludes that there's no way for it to make
all the inferred types work together, it may end up assigning blame to some other
closure entirely and giving you an error message that makes no sense at all.

When faced with this kind of enigmatic complaint, a good rule of thumb is to
double-check your argument and return types carefully. If everything looks OK, 
temporarily add explicit type information as shown above, just to rule
out misinference as a possible cause.

### Try moving code to a temporary inline function

Try taking the code out of a closure and putting it in a standalone function. Now Swift
will give you the *real* error message. For example:

```swift
func doStuff() {
    firstly {
        foo()
    }.then {
        let bar = bar()
        let baz = baz()
        when(fulfilled: bar, baz)
    }
}
```

Becomes:

```swift
func doStuff() {
    func fluff() -> Promise<…> {
        let bar = bar()
        let baz = baz()
        when(fulfilled: bar, baz)  
    }

    firstly {
        foo()
    }.then {
        fluff()
    }
}
```

An *inline* function like this is all you need. Here, the problem is that you
forgot to mark the last line of the closure with an explicit `return`. It's required
here because the closure is longer than one line.


## You copied code off the Internet that doesn’t work

Swift has changed a lot over the years and so PromiseKit has had to change to keep
up. The code you copied is probably for an older PromiseKit. *Read the definitions of the
functions.* It's easy to do this in Xcode by option-clicking or command-clicking function names.
All PromiseKit functions are documented and provide examples.

## "Context type for closure argument expects 1 argument, which cannot be implicitly ignored"

You have a `then`; you want a `done`.

## "Missing argument for parameter #1 in call"

This is part of Swift 4’s “tuplegate”.

You must specify your `Void` parameter:

```swift
seal.fulfill(())
```

Yes: we hope they revert this change in Swift 5 too.

## "Ambiguous reference to 'firstly(execute:)'"

Remove the firstly, e.g.:

```swift
firstly {
    foo()
}.then {
    //…
}
```

becomes: 

```swift
foo().then {
    //…
}
```

Rebuild and Swift should now tell you the *real* error.

## Other issues

### `Pending Promise Deallocated!`

If you see this warning, you have a path in your `Promise` initializer that allows
the promise to escape without being sealed:

```swift
Promise<String> { seal in
    task { value, error in
        if let value = value as? String {
            seal.fulfill(value)
        } else if let error = error {
            seal.reject(error)
        }
    }
}
```

There are two missing paths here, and if either occurs, the promise will soon be
deallocated without resolving. This will manifest itself as a bug in your app,
probably the awful infinite spinner.

So let’s be thorough:

```swift
Promise<String> { seal in
    task { value, error in
        if let value = value as? String {
            fulfill(value)
        } else if let error = error {
            reject(error)
        } else if value != nil {
            reject(MyError.valueNotString)
        } else {
            // should never happen, but we have an `PMKError` for task being called with `nil`, `nil`
            reject(PMKError.invalidCallingConvention)
        }
    }
}
```

If this seems tedious, it shouldn’t. You would have to be this thorough without promises, too.
The difference is that without promises, you wouldn’t get a warning in the console notifying
you of your mistake!

### Slow compilation / compiler cannot solve in reasonable time

Add return types to your closures.

### My promise never resolves

There are several potential causes:

#### 1. Check to be sure that your asynchronous task even *starts*

You’d be surprised how often this is the cause.

For example, if you are using `URLSession` without our extension (but
don’t do that; *use* our extension! we know all the pitfalls), did you forget
to call `resume` on the task? If so, the task never actually starts, and so of
course it never finishes, either.

#### 2. Check that all paths in your custom Promise initializers are handled

See “Pending Promise Deallocated” above. Usually you will see this warning if
you are not handling a path, but that requires your promise deallocate, so you
may not see this warning yet you are still not handling all paths.

Unhandled paths mean the promise will not resolve.

#### 3. Ensure the queue your promise handler runs upon is not blocked

If the thread is blocked the handlers cannot execute. Commonly you can see this
if you are using our `wait()` function. Please read the documentation for `wait()`
for suggestions and caveats.

#### 4. Your promise returned a cancellation error

Cancelation is neither success nor failure. So this is the correct behavior. 
Use a `finally` if you need to do some clean up.

### `Result of call to 'done(on:_:)' is unused`, `Result of call to 'then(on:_:)' is unused`

PromiseKit deliberately avoids the `@discardableResult` annotation because the
unused result warning is a hint that you have not handled the error in your
chain. So do one of these:

1. Add a `catch`
2. `return` the promise (thus punting the error handling to the caller)
3. Use `cauterize()` to silence the warning.

Obviously, do 1 or 2 in preference to 3.


================================================
FILE: LICENSE
================================================
Copyright 2016-present, Max Howell; mxcl@me.com

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: Package.swift
================================================
// swift-tools-version:4.0

import PackageDescription

let pkg = Package(name: "PromiseKit")
pkg.products = [
    .library(name: "PromiseKit", targets: ["PromiseKit"]),
]

let pmk: Target = .target(name: "PromiseKit")
pmk.path = "Sources"
pmk.exclude = [
    "AnyPromise.swift",
    "AnyPromise.m",
    "PMKCallVariadicBlock.m",
    "dispatch_promise.m",
    "join.m",
    "when.m",
    "NSMethodSignatureForBlock.m",
    "after.m",
    "hang.m",
    "race.m",
    "Deprecations.swift"
]
pkg.swiftLanguageVersions = [3, 4, 5]
pkg.targets = [
    pmk,
    .testTarget(name: "APlus", dependencies: ["PromiseKit"], path: "Tests/A+"),
    .testTarget(name: "CorePromise", dependencies: ["PromiseKit"], path: "Tests/CorePromise"),
]


================================================
FILE: Package@swift-4.2.swift
================================================
// swift-tools-version:4.2

import PackageDescription

let pkg = Package(name: "PromiseKit")
pkg.products = [
    .library(name: "PromiseKit", targets: ["PromiseKit"]),
]

let pmk: Target = .target(name: "PromiseKit")
pmk.path = "Sources"
pmk.exclude = [
    "AnyPromise.swift",
    "AnyPromise.m",
    "PMKCallVariadicBlock.m",
    "dispatch_promise.m",
    "join.m",
    "when.m",
    "NSMethodSignatureForBlock.m",
    "after.m",
    "hang.m",
    "race.m",
    "Deprecations.swift"
]
pkg.swiftLanguageVersions = [.v3, .v4, .v4_2]
pkg.targets = [
    pmk,
    .testTarget(name: "APlus", dependencies: ["PromiseKit"], path: "Tests/A+"),
    .testTarget(name: "CorePromise", dependencies: ["PromiseKit"], path: "Tests/CorePromise"),
]


================================================
FILE: Package@swift-5.0.swift
================================================
// swift-tools-version:5.0

import PackageDescription

let pkg = Package(name: "PromiseKit")
pkg.platforms = [
   .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)
]
pkg.products = [
    .library(name: "PromiseKit", targets: ["PromiseKit"]),
]

let pmk: Target = .target(name: "PromiseKit")
pmk.path = "Sources"
pmk.exclude = [
    "AnyPromise.swift",
    "AnyPromise.m",
    "PMKCallVariadicBlock.m",
    "dispatch_promise.m",
    "join.m",
    "when.m",
    "NSMethodSignatureForBlock.m",
    "after.m",
    "hang.m",
    "race.m",
    "Deprecations.swift"
]
pkg.swiftLanguageVersions = [.v4, .v4_2, .v5]
pkg.targets = [
    pmk,
    .testTarget(name: "APlus", dependencies: ["PromiseKit"], path: "Tests/A+"),
    .testTarget(name: "CorePromise", dependencies: ["PromiseKit"], path: "Tests/CorePromise"),
]


================================================
FILE: Package@swift-5.3.swift
================================================
// swift-tools-version:5.3

import PackageDescription

let pkg = Package(name: "PromiseKit")
pkg.platforms = [
   .macOS(.v10_10), .iOS(.v9), .tvOS(.v9), .watchOS(.v2)
]
pkg.products = [
    .library(name: "PromiseKit", targets: ["PromiseKit"]),
]

let pmk: Target = .target(name: "PromiseKit")
pmk.path = "Sources"
pmk.resources = [
    .process("Resources/PrivacyInfo.xcprivacy")
]
pmk.exclude = [
    "AnyPromise.swift",
    "AnyPromise.m",
    "PMKCallVariadicBlock.m",
    "dispatch_promise.m",
    "join.m",
    "when.m",
    "NSMethodSignatureForBlock.m",
    "after.m",
    "hang.m",
    "race.m",
    "Deprecations.swift",
    "Info.plist"
]
pkg.swiftLanguageVersions = [.v4, .v4_2, .v5]
pkg.targets = [
    pmk,
    .testTarget(name: "APlus", dependencies: ["PromiseKit"], path: "Tests/A+", exclude: ["README.md"]),
    .testTarget(name: "CorePromise", dependencies: ["PromiseKit"], path: "Tests/CorePromise"),
]


================================================
FILE: PromiseKit.playground/Contents.swift
================================================
import PlaygroundSupport

// Is this erroring? If so open the `.xcodeproj` and build the
// framework for a macOS target (usually labeled: “My Mac”).
// Then select `PromiseKit.playground` from inside Xcode.
import PromiseKit


func promise3() -> Promise<Int> {
    return after(.seconds(1)).map{ 3 }
}

firstly {
    Promise.value(1)
}.map { _ in
    2
}.then { _ in
    promise3()
}.done {
    print($0)  // => 3
}.catch { error in
    // only happens for errors
}.finally {
    PlaygroundPage.current.finishExecution()
}

PlaygroundPage.current.needsIndefiniteExecution = true


================================================
FILE: PromiseKit.playground/contents.xcplayground
================================================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='3.0' sdk='macosx' auto-termination-delay='2'>
    <sections>
        <code source-file-name='section-1.swift'/>
    </sections>
    <timeline fileName='timeline.xctimeline'/>
</playground>

================================================
FILE: PromiseKit.playground/playground.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:">
   </FileRef>
</Workspace>


================================================
FILE: PromiseKit.podspec
================================================
Pod::Spec.new do |s|
  s.name = "PromiseKit"

  s.version = '8.2.0'

  s.source = {
    :git => "https://github.com/mxcl/#{s.name}.git",
    :tag => s.version,
    :submodules => true
  }

  s.license = 'MIT'
  s.summary = 'Promises for Swift & ObjC.'
  s.homepage = 'http://mxcl.dev/PromiseKit/'
  s.description = 'A thoughtful and complete implementation of promises for iOS, macOS, watchOS and tvOS with first-class support for both Objective-C and Swift.'
  s.social_media_url = 'https://twitter.com/mxcl'
  s.authors  = { 'Max Howell' => 'mxcl@me.com' }
  s.documentation_url = 'http://mxcl.dev/PromiseKit/reference/v6/Classes/Promise.html'
  s.default_subspecs = 'CorePromise', 'UIKit', 'Foundation'
  s.requires_arc = true

  s.swift_version = '3.2', '3.3', '3.4', '4.0', '4.1', '4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5'

  # CocoaPods requires us to specify the root deployment targets
  # even though for us it is nonsense. Our root spec has no
  # sources.
  s.ios.deployment_target = '10.0'
  s.osx.deployment_target = '10.13'
  s.watchos.deployment_target = '4.0'
  s.tvos.deployment_target = '10.0'
  s.visionos.deployment_target = '1.0'

  s.pod_target_xcconfig = {
    'OTHER_SWIFT_FLAGS' => '-DPMKCocoaPods',
  }

  s.resource_bundles = {
    'PromiseKit_Privacy' => 'Sources/Resources/PrivacyInfo.xcprivacy'
  }

  s.subspec 'Accounts' do |ss|
    ss.ios.source_files = ss.osx.source_files = 'Extensions/Accounts/Sources/**/*'
    ss.exclude_files = 'Extensions/Accounts/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = 'Accounts'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
  end

  s.subspec 'AddressBook' do |ss|
    ss.ios.source_files = 'Extensions/AddressBook/Sources/**/*'
    ss.exclude_files = 'Extensions/AddressBook/Sources/*.plist'
    ss.ios.frameworks = 'AddressBook'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
  end

  s.subspec 'AssetsLibrary' do |ss|
    ss.ios.source_files = 'Extensions/AssetsLibrary/Sources/**/*'
    ss.exclude_files = 'Extensions/AssetsLibrary/Sources/*.plist'
    ss.ios.frameworks = 'AssetsLibrary'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
  end

  s.subspec 'AVFoundation' do |ss|
    ss.ios.source_files = 'Extensions/AVFoundation/Sources/**/*'
    ss.exclude_files = 'Extensions/AVFoundation/Sources/*.plist'
    ss.ios.frameworks = 'AVFoundation'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
  end

  s.subspec 'CloudKit' do |ss|
    ss.source_files = 'Extensions/CloudKit/Sources/**/*'
    ss.exclude_files = 'Extensions/CloudKit/Sources/*.plist'
    ss.frameworks = 'CloudKit'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
    ss.watchos.deployment_target = '4.0'
  end

  s.subspec 'CoreBluetooth' do |ss|
    ss.ios.source_files = ss.osx.source_files = ss.tvos.source_files = 'Extensions/CoreBluetooth/Sources/**/*'
    ss.exclude_files = 'Extensions/CoreBluetooth/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = ss.tvos.frameworks = 'CoreBluetooth'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'CorePromise' do |ss|
    hh = Dir['Sources/*.h'] - Dir['Sources/*+Private.h']

    cc = Dir['Sources/*.swift'] - ['Sources/SwiftPM.swift']
    cc << 'Sources/{after,AnyPromise,GlobalState,dispatch_promise,hang,join,PMKPromise,when,race}.m'
    cc += hh

    ss.source_files = cc
    ss.exclude_files = 'Sources/*.plist'
    ss.public_header_files = hh
    ss.preserve_paths = 'Sources/AnyPromise+Private.h', 'Sources/PMKCallVariadicBlock.m', 'Sources/NSMethodSignatureForBlock.m'
    ss.frameworks = 'Foundation'

    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.watchos.deployment_target = '4.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'CoreLocation' do |ss|
    ss.source_files = 'Extensions/CoreLocation/Sources/**/*'
    ss.exclude_files = 'Extensions/CoreLocation/Sources/*.plist'
    ss.watchos.source_files = 'Extensions/CoreLocation/Sources/CLGeocoder*'
    ss.dependency 'PromiseKit/CorePromise'
    ss.frameworks = 'CoreLocation'

    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.watchos.deployment_target = '4.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'EventKit' do |ss|
    ss.ios.source_files = ss.osx.source_files = ss.watchos.source_files = 'Extensions/EventKit/Sources/**/*'
    ss.exclude_files = 'Extensions/EventKit/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = ss.watchos.frameworks = 'EventKit'
    ss.dependency 'PromiseKit/CorePromise'

    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.watchos.deployment_target = '4.0'
  end

  s.subspec 'Foundation' do |ss|
    ss.source_files = Dir['Extensions/Foundation/Sources/**/*']
    ss.exclude_files = 'Extensions/Foundation/Sources/*.plist'
    ss.dependency 'PromiseKit/CorePromise'
    ss.frameworks = 'Foundation'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.watchos.deployment_target = '4.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'HealthKit' do |ss|
    ss.source_files = Dir['Extensions/HealthKit/Sources/**/*']
    ss.exclude_files = 'Extensions/HealthKit/Sources/*.plist'
    ss.dependency 'PromiseKit/CorePromise'
    ss.frameworks = 'HealthKit'
    ss.ios.deployment_target = '10.0'
    ss.watchos.deployment_target = '4.0'
  end

  s.subspec 'HomeKit' do |ss|
    ss.source_files = Dir['Extensions/HomeKit/Sources/**/*']
    ss.exclude_files = 'Extensions/HomeKit/Sources/*.plist'
    ss.dependency 'PromiseKit/CorePromise'
    ss.frameworks = 'HomeKit'
    ss.ios.deployment_target = '10.0'
    ss.watchos.deployment_target = '4.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'MapKit' do |ss|
    ss.ios.source_files = ss.osx.source_files = ss.tvos.source_files = 'Extensions/MapKit/Sources/**/*'
    ss.exclude_files = 'Extensions/MapKit/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = ss.tvos.frameworks = 'MapKit'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.watchos.deployment_target = '4.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'MessageUI' do |ss|
    ss.ios.source_files = 'Extensions/MessagesUI/Sources/**/*'
    ss.exclude_files = 'Extensions/MessagesUI/Sources/*.plist'
    ss.ios.frameworks = 'MessageUI'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
  end

  s.subspec 'Photos' do |ss|
    ss.ios.source_files = ss.tvos.source_files = ss.osx.source_files = 'Extensions/Photos/Sources/**/*'
    ss.exclude_files = 'Extensions/Photos/Sources/*.plist'
    ss.ios.frameworks = ss.tvos.frameworks = ss.osx.frameworks = 'Photos'
    ss.dependency 'PromiseKit/CorePromise'

    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'QuartzCore' do |ss|
    ss.osx.source_files = ss.ios.source_files = ss.tvos.source_files = 'Extensions/QuartzCore/Sources/**/*'
    ss.exclude_files = 'Extensions/QuartzCore/Sources/*.plist'
    ss.osx.frameworks = ss.ios.frameworks = ss.tvos.frameworks = 'QuartzCore'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'Social' do |ss|
    ss.ios.source_files = 'Extensions/Social/Sources/**/*'
    ss.exclude_files = 'Extensions/Social/Sources/*.plist'
    ss.osx.source_files = Dir['Extensions/Social/Sources/*'] - ['Categories/Social/Sources/*SLComposeViewController+Promise.swift']
    ss.ios.frameworks = ss.osx.frameworks = 'Social'
    ss.dependency 'PromiseKit/Foundation'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
  end

  s.subspec 'StoreKit' do |ss|
    ss.ios.source_files = ss.osx.source_files = ss.tvos.source_files = 'Extensions/StoreKit/Sources/**/*'
    ss.exclude_files = 'Extensions/StoreKit/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = ss.tvos.frameworks = 'StoreKit'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'SystemConfiguration' do |ss|
    ss.ios.source_files = ss.osx.source_files = ss.tvos.source_files = 'Extensions/SystemConfiguration/Sources/**/*'
    ss.exclude_files = 'Extensions/SystemConfiguration/Sources/*.plist'
    ss.ios.frameworks = ss.osx.frameworks = ss.tvos.frameworks = 'SystemConfiguration'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.osx.deployment_target = '10.13'
    ss.tvos.deployment_target = '10.0'
  end

  picker_cc = 'Extensions/UIKit/Sources/UIImagePickerController+Promise.swift'

  s.subspec 'UIKit' do |ss|
    ss.ios.source_files = ss.tvos.source_files = Dir['Extensions/UIKit/Sources/**/*'] - [picker_cc]
    ss.exclude_files = 'Extensions/UIKit/Sources/*.plist'
    ss.tvos.frameworks = ss.ios.frameworks = 'UIKit'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.tvos.deployment_target = '10.0'
  end

  s.subspec 'UIImagePickerController' do |ss|
    # Since iOS 10, App Store submissions that contain references to
    # UIImagePickerController (even if unused in 3rd party libraries)
    # are rejected unless an Info.plist key is specified, thus we
    # moved this code to a sub-subspec.
    #
    # This *was* a subspec of UIKit, but bizarrely CocoaPods would
    # include this when specifying *just* UIKit…!

    ss.ios.source_files = picker_cc
    ss.exclude_files = 'Extensions/UIKit/Sources/*.plist'
    ss.ios.frameworks = 'UIKit'
    ss.ios.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) PMKImagePickerController=1' }
    ss.dependency 'PromiseKit/UIKit'
    ss.ios.deployment_target = '10.0'
  end

  s.subspec 'WatchConnectivity' do |ss|
    ss.ios.source_files = ss.watchos.source_files = 'Extensions/WatchConnectivity/Sources/**/*'
    ss.exclude_files = 'Extensions/WatchConnectivity/Sources/*.plist'
    ss.ios.frameworks = ss.watchos.frameworks = 'WatchConnectivity'
    ss.dependency 'PromiseKit/CorePromise'
    ss.ios.deployment_target = '10.0'
    ss.watchos.deployment_target = '4.0'
  end
end


================================================
FILE: PromiseKit.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		085B96B321A6359500E5E22F /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085B96B121A6358900E5E22F /* LoggingTests.swift */; };
		085B96BF21A9B37C00E5E22F /* LogEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 085B96BE21A9B37C00E5E22F /* LogEvent.swift */; };
		0C42F31B1FCF86320051309C /* HangTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C42F3191FCF86240051309C /* HangTests.swift */; };
		0CC3AF2B1FCF84F7000E98C9 /* hang.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC3AF2A1FCF84F7000E98C9 /* hang.swift */; };
		49A5584D1DC5185900E4D01B /* ResolverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49A5584B1DC5172F00E4D01B /* ResolverTests.swift */; };
		630A8056203CEF6800D25F23 /* AnyPromiseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630A8051203CEF6800D25F23 /* AnyPromiseTests.m */; settings = {COMPILER_FLAGS = "-fobjc-arc-exceptions"; }; };
		630A8057203CEF6800D25F23 /* PMKManifoldTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630A8052203CEF6800D25F23 /* PMKManifoldTests.m */; };
		630A8058203CEF6800D25F23 /* JoinTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630A8053203CEF6800D25F23 /* JoinTests.m */; };
		630A8059203CEF6800D25F23 /* HangTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630A8054203CEF6800D25F23 /* HangTests.m */; };
		630A805A203CEF6800D25F23 /* WhenTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630A8055203CEF6800D25F23 /* WhenTests.m */; };
		630A805B203CF67800D25F23 /* DefaultDispatchQueueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D641B1D59635300BC0AF5 /* DefaultDispatchQueueTests.swift */; };
		631411381D59795700E24B9E /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */; };
		631411431D59797100E24B9E /* BridgingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6314113E1D59797100E24B9E /* BridgingTests.m */; };
		631411441D59797100E24B9E /* BridgingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6314113F1D59797100E24B9E /* BridgingTests.swift */; };
		631411451D59797100E24B9E /* Infrastructure.m in Sources */ = {isa = PBXBuildFile; fileRef = 631411411D59797100E24B9E /* Infrastructure.m */; };
		631411461D59797100E24B9E /* Infrastructure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631411421D59797100E24B9E /* Infrastructure.swift */; };
		631751A41D59766500A9DDDC /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */; };
		631751B71D59768200A9DDDC /* 0.0.0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751AB1D59768200A9DDDC /* 0.0.0.swift */; };
		631751B81D59768200A9DDDC /* 2.1.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751AC1D59768200A9DDDC /* 2.1.2.swift */; };
		631751B91D59768200A9DDDC /* 2.1.3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751AD1D59768200A9DDDC /* 2.1.3.swift */; };
		631751BA1D59768200A9DDDC /* 2.2.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751AE1D59768200A9DDDC /* 2.2.2.swift */; };
		631751BB1D59768200A9DDDC /* 2.2.3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751AF1D59768200A9DDDC /* 2.2.3.swift */; };
		631751BC1D59768200A9DDDC /* 2.2.4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B01D59768200A9DDDC /* 2.2.4.swift */; };
		631751BD1D59768200A9DDDC /* 2.2.6.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B11D59768200A9DDDC /* 2.2.6.swift */; };
		631751BE1D59768200A9DDDC /* 2.2.7.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B21D59768200A9DDDC /* 2.2.7.swift */; };
		631751BF1D59768200A9DDDC /* 2.3.1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B31D59768200A9DDDC /* 2.3.1.swift */; };
		631751C01D59768200A9DDDC /* 2.3.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B41D59768200A9DDDC /* 2.3.2.swift */; };
		631751C11D59768200A9DDDC /* 2.3.4.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631751B51D59768200A9DDDC /* 2.3.4.swift */; };
		632FBBE31F33B273008F8FBB /* Catchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 632FBBE21F33B273008F8FBB /* Catchable.swift */; };
		632FBBE51F33B338008F8FBB /* CatchableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 632FBBE41F33B338008F8FBB /* CatchableTests.swift */; };
		633027E6203CC0060037E136 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */; };
		6330B5E11F2E991200D60528 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6330B5E01F2E991200D60528 /* Configuration.swift */; };
		634AAD2B1EAE517C00B17855 /* fwd.h in Headers */ = {isa = PBXBuildFile; fileRef = 634AAD2A1EAE517C00B17855 /* fwd.h */; settings = {ATTRIBUTES = (Public, ); }; };
		635D641D1D59635300BC0AF5 /* PromiseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64081D59635300BC0AF5 /* PromiseTests.swift */; };
		635D641E1D59635300BC0AF5 /* CancellableErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64091D59635300BC0AF5 /* CancellableErrorTests.swift */; };
		635D64221D59635300BC0AF5 /* ZalgoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D640D1D59635300BC0AF5 /* ZalgoTests.swift */; };
		635D64231D59635300BC0AF5 /* AfterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D640E1D59635300BC0AF5 /* AfterTests.swift */; };
		635D64261D59635300BC0AF5 /* WhenResolvedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64111D59635300BC0AF5 /* WhenResolvedTests.swift */; };
		635D64271D59635300BC0AF5 /* RaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64121D59635300BC0AF5 /* RaceTests.swift */; };
		635D64281D59635300BC0AF5 /* WhenConcurrentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64131D59635300BC0AF5 /* WhenConcurrentTests.swift */; };
		635D642A1D59635300BC0AF5 /* WhenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64151D59635300BC0AF5 /* WhenTests.swift */; };
		635D642B1D59635300BC0AF5 /* StressTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64161D59635300BC0AF5 /* StressTests.swift */; };
		635D642C1D59635300BC0AF5 /* RegressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 635D64171D59635300BC0AF5 /* RegressionTests.swift */; };
		635D64301D596E8500BC0AF5 /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */; };
		636A291A1F1C156B001229C2 /* Promise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A29191F1C156B001229C2 /* Promise.swift */; };
		636A291F1F1C16FF001229C2 /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A291E1F1C16FF001229C2 /* Box.swift */; };
		636A29211F1C1716001229C2 /* Thenable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A29201F1C1716001229C2 /* Thenable.swift */; };
		636A29231F1C17A6001229C2 /* Guarantee.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A29221F1C17A6001229C2 /* Guarantee.swift */; };
		636A29251F1C3089001229C2 /* race.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A29241F1C3089001229C2 /* race.swift */; };
		636A29271F1C3927001229C2 /* Resolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636A29261F1C3927001229C2 /* Resolver.swift */; };
		639BF757203DF03100FA577B /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639BF755203DF02C00FA577B /* Utilities.swift */; };
		63B0AC7F1D595E6300FA21D9 /* after.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC611D595E6300FA21D9 /* after.m */; };
		63B0AC801D595E6300FA21D9 /* after.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC621D595E6300FA21D9 /* after.swift */; };
		63B0AC811D595E6300FA21D9 /* AnyPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = 63B0AC631D595E6300FA21D9 /* AnyPromise.h */; settings = {ATTRIBUTES = (Public, ); }; };
		63B0AC821D595E6300FA21D9 /* AnyPromise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC641D595E6300FA21D9 /* AnyPromise.m */; };
		63B0AC831D595E6300FA21D9 /* AnyPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC651D595E6300FA21D9 /* AnyPromise.swift */; };
		63B0AC841D595E6300FA21D9 /* AnyPromise+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 63B0AC661D595E6300FA21D9 /* AnyPromise+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
		63B0AC851D595E6300FA21D9 /* dispatch_promise.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC671D595E6300FA21D9 /* dispatch_promise.m */; };
		63B0AC871D595E6300FA21D9 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC691D595E6300FA21D9 /* Error.swift */; };
		63B0AC891D595E6300FA21D9 /* hang.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC6B1D595E6300FA21D9 /* hang.m */; };
		63B0AC8B1D595E6300FA21D9 /* join.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC6D1D595E6300FA21D9 /* join.m */; };
		63B0AC931D595E6300FA21D9 /* PromiseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 63B0AC761D595E6300FA21D9 /* PromiseKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
		63B0AC991D595E6300FA21D9 /* when.m in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC7C1D595E6300FA21D9 /* when.m */; };
		63B0AC9A1D595E6300FA21D9 /* when.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B0AC7D1D595E6300FA21D9 /* when.swift */; };
		63B18AEC1F2D205C00B79E37 /* CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B18AEB1F2D205C00B79E37 /* CustomStringConvertible.swift */; };
		63B7C94B203E2B8200FBEC00 /* AnyPromiseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7C94A203E2B8200FBEC00 /* AnyPromiseTests.swift */; };
		63B912AA1F1D7B1300D49110 /* firstly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B912A91F1D7B1300D49110 /* firstly.swift */; };
		63CF6D7A203CC66000EC8927 /* ErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CF6D79203CC66000EC8927 /* ErrorTests.swift */; };
		63CF6D7C203CCDAB00EC8927 /* GuaranteeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CF6D7B203CCDAB00EC8927 /* GuaranteeTests.swift */; };
		63CF6D7E203CD12700EC8927 /* DeprecationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63648C94203CB97400EBA011 /* DeprecationTests.swift */; };
		63CF6D80203CD19200EC8927 /* ThenableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63CF6D7F203CD19200EC8927 /* ThenableTests.swift */; };
		63D9B2EF203385FD0075C00B /* race.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D9B2EE203385FD0075C00B /* race.m */; };
		63D9B2F120338D5D0075C00B /* Deprecations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D9B2F020338D5D0075C00B /* Deprecations.swift */; };
		9E4170F9287D88C900A3B4B5 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E4170F8287D88C800A3B4B5 /* Async.swift */; };
		9E4170FC287D8DF900A3B4B5 /* AsyncTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E4170FA287D8DBD00A3B4B5 /* AsyncTests.swift */; };
		9E66231626FE5A8C00FA25CB /* RaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E66231526FE5A8C00FA25CB /* RaceTests.m */; };
		9EC774272991495C00803027 /* Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC774262991495C00803027 /* Combine.swift */; };
		9EC7742A2991498200803027 /* CombineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EC774282991497900803027 /* CombineTests.swift */; };
		C013F7382048E3B6006B57B1 /* MockNodeEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */; };
		C013F73A2049076A006B57B1 /* JSPromise.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F7392049076A006B57B1 /* JSPromise.swift */; };
		C013F73C20494291006B57B1 /* JSAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F73B20494291006B57B1 /* JSAdapter.swift */; };
		C013F740204E5064006B57B1 /* JSUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = C013F73F204E5063006B57B1 /* JSUtils.swift */; };
		C0244E5E2047A6CB00ACB4AC /* PromiseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */; };
		C0244E692047AC9F00ACB4AC /* AllTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0244E682047AC9F00ACB4AC /* AllTests.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
		631411341D59795700E24B9E /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 6399A3721D595D9100D65233 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 63B0AC561D595E1B00FA21D9;
			remoteInfo = PromiseKit;
		};
		6317518D1D59766500A9DDDC /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 6399A3721D595D9100D65233 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 63B0AC561D595E1B00FA21D9;
			remoteInfo = PromiseKit;
		};
		633027E2203CC0060037E136 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 6399A3721D595D9100D65233 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 63B0AC561D595E1B00FA21D9;
			remoteInfo = PromiseKit;
		};
		635D64041D5962F900BC0AF5 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 6399A3721D595D9100D65233 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 63B0AC561D595E1B00FA21D9;
			remoteInfo = PromiseKit;
		};
		C0244E502047A6CB00ACB4AC /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 6399A3721D595D9100D65233 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 63B0AC561D595E1B00FA21D9;
			remoteInfo = PromiseKit;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
		C0244E6E2047AF0B00ACB4AC /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = "";
			dstSubfolderSpec = 7;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		085B96B121A6358900E5E22F /* LoggingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggingTests.swift; sourceTree = "<group>"; };
		085B96BE21A9B37C00E5E22F /* LogEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LogEvent.swift; path = Sources/LogEvent.swift; sourceTree = "<group>"; };
		0C42F3191FCF86240051309C /* HangTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HangTests.swift; sourceTree = "<group>"; };
		0CC3AF2A1FCF84F7000E98C9 /* hang.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = hang.swift; path = Sources/hang.swift; sourceTree = "<group>"; };
		1F1DCDF72A27AB6400E7A16B /* PromiseKit.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = PromiseKit.podspec; sourceTree = "<group>"; };
		49A5584B1DC5172F00E4D01B /* ResolverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResolverTests.swift; sourceTree = "<group>"; };
		630019221D596292003B4E30 /* PMKCoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKCoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		630A8051203CEF6800D25F23 /* AnyPromiseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnyPromiseTests.m; sourceTree = "<group>"; };
		630A8052203CEF6800D25F23 /* PMKManifoldTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PMKManifoldTests.m; sourceTree = "<group>"; };
		630A8053203CEF6800D25F23 /* JoinTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JoinTests.m; sourceTree = "<group>"; };
		630A8054203CEF6800D25F23 /* HangTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HangTests.m; sourceTree = "<group>"; };
		630A8055203CEF6800D25F23 /* WhenTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WhenTests.m; sourceTree = "<group>"; };
		6314113C1D59795700E24B9E /* PMKBridgeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKBridgeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		6314113E1D59797100E24B9E /* BridgingTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgingTests.m; sourceTree = "<group>"; };
		6314113F1D59797100E24B9E /* BridgingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BridgingTests.swift; sourceTree = "<group>"; };
		631411401D59797100E24B9E /* Infrastructure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Infrastructure.h; sourceTree = "<group>"; };
		631411411D59797100E24B9E /* Infrastructure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Infrastructure.m; sourceTree = "<group>"; };
		631411421D59797100E24B9E /* Infrastructure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Infrastructure.swift; sourceTree = "<group>"; };
		631751A81D59766500A9DDDC /* PMKA+Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "PMKA+Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
		631751AB1D59768200A9DDDC /* 0.0.0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 0.0.0.swift; sourceTree = "<group>"; };
		631751AC1D59768200A9DDDC /* 2.1.2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.1.2.swift; sourceTree = "<group>"; };
		631751AD1D59768200A9DDDC /* 2.1.3.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.1.3.swift; sourceTree = "<group>"; };
		631751AE1D59768200A9DDDC /* 2.2.2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.2.2.swift; sourceTree = "<group>"; };
		631751AF1D59768200A9DDDC /* 2.2.3.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.2.3.swift; sourceTree = "<group>"; };
		631751B01D59768200A9DDDC /* 2.2.4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.2.4.swift; sourceTree = "<group>"; };
		631751B11D59768200A9DDDC /* 2.2.6.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.2.6.swift; sourceTree = "<group>"; };
		631751B21D59768200A9DDDC /* 2.2.7.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.2.7.swift; sourceTree = "<group>"; };
		631751B31D59768200A9DDDC /* 2.3.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.3.1.swift; sourceTree = "<group>"; };
		631751B41D59768200A9DDDC /* 2.3.2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.3.2.swift; sourceTree = "<group>"; };
		631751B51D59768200A9DDDC /* 2.3.4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = 2.3.4.swift; sourceTree = "<group>"; };
		631751B61D59768200A9DDDC /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
		632FBBE21F33B273008F8FBB /* Catchable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Catchable.swift; path = Sources/Catchable.swift; sourceTree = "<group>"; };
		632FBBE41F33B338008F8FBB /* CatchableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CatchableTests.swift; sourceTree = "<group>"; };
		633027EA203CC0060037E136 /* PMKDeprecatedTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PMKDeprecatedTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		6330B5E01F2E991200D60528 /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Configuration.swift; path = Sources/Configuration.swift; sourceTree = "<group>"; };
		634AAD2A1EAE517C00B17855 /* fwd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fwd.h; path = Sources/fwd.h; sourceTree = "<group>"; };
		635893921D5BE4E000F14B55 /* PromiseKit.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = PromiseKit.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
		635893941D5BE4F900F14B55 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
		635893951D5BE4F900F14B55 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
		635893971D5BE4F900F14B55 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
		635D64081D59635300BC0AF5 /* PromiseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseTests.swift; sourceTree = "<group>"; };
		635D64091D59635300BC0AF5 /* CancellableErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CancellableErrorTests.swift; sourceTree = "<group>"; };
		635D640D1D59635300BC0AF5 /* ZalgoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZalgoTests.swift; sourceTree = "<group>"; };
		635D640E1D59635300BC0AF5 /* AfterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AfterTests.swift; sourceTree = "<group>"; };
		635D64111D59635300BC0AF5 /* WhenResolvedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhenResolvedTests.swift; sourceTree = "<group>"; };
		635D64121D59635300BC0AF5 /* RaceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RaceTests.swift; sourceTree = "<group>"; };
		635D64131D59635300BC0AF5 /* WhenConcurrentTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhenConcurrentTests.swift; sourceTree = "<group>"; };
		635D64151D59635300BC0AF5 /* WhenTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhenTests.swift; sourceTree = "<group>"; };
		635D64161D59635300BC0AF5 /* StressTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StressTests.swift; sourceTree = "<group>"; };
		635D64171D59635300BC0AF5 /* RegressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegressionTests.swift; sourceTree = "<group>"; };
		635D641B1D59635300BC0AF5 /* DefaultDispatchQueueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DefaultDispatchQueueTests.swift; sourceTree = "<group>"; };
		63648C94203CB97400EBA011 /* DeprecationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DeprecationTests.swift; path = Tests/DeprecationTests.swift; sourceTree = "<group>"; };
		636A29191F1C156B001229C2 /* Promise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Promise.swift; path = Sources/Promise.swift; sourceTree = "<group>"; };
		636A291E1F1C16FF001229C2 /* Box.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Box.swift; path = Sources/Box.swift; sourceTree = "<group>"; };
		636A29201F1C1716001229C2 /* Thenable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Thenable.swift; path = Sources/Thenable.swift; sourceTree = "<group>"; };
		636A29221F1C17A6001229C2 /* Guarantee.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Guarantee.swift; path = Sources/Guarantee.swift; sourceTree = "<group>"; };
		636A29241F1C3089001229C2 /* race.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = race.swift; path = Sources/race.swift; sourceTree = "<group>"; };
		636A29261F1C3927001229C2 /* Resolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Resolver.swift; path = Sources/Resolver.swift; sourceTree = "<group>"; };
		639BF755203DF02C00FA577B /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
		63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PromiseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
		63B0AC611D595E6300FA21D9 /* after.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = after.m; path = Sources/after.m; sourceTree = "<group>"; };
		63B0AC621D595E6300FA21D9 /* after.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = after.swift; path = Sources/after.swift; sourceTree = "<group>"; };
		63B0AC631D595E6300FA21D9 /* AnyPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnyPromise.h; path = Sources/AnyPromise.h; sourceTree = "<group>"; };
		63B0AC641D595E6300FA21D9 /* AnyPromise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AnyPromise.m; path = Sources/AnyPromise.m; sourceTree = "<group>"; };
		63B0AC651D595E6300FA21D9 /* AnyPromise.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnyPromise.swift; path = Sources/AnyPromise.swift; sourceTree = "<group>"; };
		63B0AC661D595E6300FA21D9 /* AnyPromise+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "AnyPromise+Private.h"; path = "Sources/AnyPromise+Private.h"; sourceTree = "<group>"; };
		63B0AC671D595E6300FA21D9 /* dispatch_promise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = dispatch_promise.m; path = Sources/dispatch_promise.m; sourceTree = "<group>"; };
		63B0AC691D595E6300FA21D9 /* Error.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Error.swift; path = Sources/Error.swift; sourceTree = "<group>"; };
		63B0AC6B1D595E6300FA21D9 /* hang.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = hang.m; path = Sources/hang.m; sourceTree = "<group>"; };
		63B0AC6C1D595E6300FA21D9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Sources/Info.plist; sourceTree = "<group>"; };
		63B0AC6D1D595E6300FA21D9 /* join.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = join.m; path = Sources/join.m; sourceTree = "<group>"; };
		63B0AC6F1D595E6300FA21D9 /* NSMethodSignatureForBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSMethodSignatureForBlock.m; path = Sources/NSMethodSignatureForBlock.m; sourceTree = "<group>"; };
		63B0AC711D595E6300FA21D9 /* PMKCallVariadicBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PMKCallVariadicBlock.m; path = Sources/PMKCallVariadicBlock.m; sourceTree = "<group>"; };
		63B0AC761D595E6300FA21D9 /* PromiseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PromiseKit.h; path = Sources/PromiseKit.h; sourceTree = "<group>"; };
		63B0AC7C1D595E6300FA21D9 /* when.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = when.m; path = Sources/when.m; sourceTree = "<group>"; };
		63B0AC7D1D595E6300FA21D9 /* when.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = when.swift; path = Sources/when.swift; sourceTree = "<group>"; };
		63B18AEB1F2D205C00B79E37 /* CustomStringConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CustomStringConvertible.swift; path = Sources/CustomStringConvertible.swift; sourceTree = "<group>"; };
		63B7C94A203E2B8200FBEC00 /* AnyPromiseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyPromiseTests.swift; sourceTree = "<group>"; };
		63B912A91F1D7B1300D49110 /* firstly.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = firstly.swift; path = Sources/firstly.swift; sourceTree = "<group>"; };
		63CF6D79203CC66000EC8927 /* ErrorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorTests.swift; sourceTree = "<group>"; };
		63CF6D7B203CCDAB00EC8927 /* GuaranteeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuaranteeTests.swift; sourceTree = "<group>"; };
		63CF6D7F203CD19200EC8927 /* ThenableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThenableTests.swift; sourceTree = "<group>"; };
		63D9B2EE203385FD0075C00B /* race.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = race.m; path = Sources/race.m; sourceTree = "<group>"; };
		63D9B2F020338D5D0075C00B /* Deprecations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Deprecations.swift; path = Sources/Deprecations.swift; sourceTree = "<group>"; };
		9E4170F8287D88C800A3B4B5 /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Async.swift; path = Sources/Async.swift; sourceTree = "<group>"; };
		9E4170FA287D8DBD00A3B4B5 /* AsyncTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncTests.swift; sourceTree = "<group>"; };
		9E66231526FE5A8C00FA25CB /* RaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RaceTests.m; sourceTree = "<group>"; };
		9E8028F72BDCEDBC0081E2D1 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
		9EC774262991495C00803027 /* Combine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Combine.swift; path = Sources/Combine.swift; sourceTree = "<group>"; };
		9EC774282991497900803027 /* CombineTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombineTests.swift; sourceTree = "<group>"; };
		C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MockNodeEnvironment.swift; path = "Tests/JS-A+/MockNodeEnvironment.swift"; sourceTree = "<group>"; };
		C013F7392049076A006B57B1 /* JSPromise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = JSPromise.swift; path = "Tests/JS-A+/JSPromise.swift"; sourceTree = "<group>"; };
		C013F73B20494291006B57B1 /* JSAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = JSAdapter.swift; path = "Tests/JS-A+/JSAdapter.swift"; sourceTree = "<group>"; };
		C013F73F204E5063006B57B1 /* JSUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = JSUtils.swift; path = "Tests/JS-A+/JSUtils.swift"; sourceTree = "<group>"; };
		C0244E622047A6CB00ACB4AC /* PMKJSA+Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "PMKJSA+Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
		C0244E682047AC9F00ACB4AC /* AllTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AllTests.swift; path = "Tests/JS-A+/AllTests.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		630019181D596292003B4E30 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				635D64301D596E8500BC0AF5 /* PromiseKit.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		631411371D59795700E24B9E /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				631411381D59795700E24B9E /* PromiseKit.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		631751A31D59766500A9DDDC /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				631751A41D59766500A9DDDC /* PromiseKit.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		633027E5203CC0060037E136 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				633027E6203CC0060037E136 /* PromiseKit.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		63B0AC531D595E1B00FA21D9 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C0244E5D2047A6CB00ACB4AC /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				C0244E5E2047A6CB00ACB4AC /* PromiseKit.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		630A8050203CEF6800D25F23 /* CoreObjC */ = {
			isa = PBXGroup;
			children = (
				630A8051203CEF6800D25F23 /* AnyPromiseTests.m */,
				63B7C94A203E2B8200FBEC00 /* AnyPromiseTests.swift */,
				630A8052203CEF6800D25F23 /* PMKManifoldTests.m */,
				630A8053203CEF6800D25F23 /* JoinTests.m */,
				630A8054203CEF6800D25F23 /* HangTests.m */,
				630A8055203CEF6800D25F23 /* WhenTests.m */,
				9E66231526FE5A8C00FA25CB /* RaceTests.m */,
			);
			name = CoreObjC;
			path = Tests/CoreObjC;
			sourceTree = "<group>";
		};
		630B60BF1F2F739E00A1AEFE /* Features */ = {
			isa = PBXGroup;
			children = (
				63B0AC611D595E6300FA21D9 /* after.m */,
				63B0AC6B1D595E6300FA21D9 /* hang.m */,
				63B0AC6D1D595E6300FA21D9 /* join.m */,
				63B0AC7C1D595E6300FA21D9 /* when.m */,
				63D9B2EE203385FD0075C00B /* race.m */,
			);
			name = Features;
			sourceTree = "<group>";
		};
		630B60C01F2F73B000A1AEFE /* Headers */ = {
			isa = PBXGroup;
			children = (
				634AAD2A1EAE517C00B17855 /* fwd.h */,
				63B0AC631D595E6300FA21D9 /* AnyPromise.h */,
			);
			name = Headers;
			sourceTree = "<group>";
		};
		6314113D1D59797100E24B9E /* Bridging */ = {
			isa = PBXGroup;
			children = (
				6314113E1D59797100E24B9E /* BridgingTests.m */,
				6314113F1D59797100E24B9E /* BridgingTests.swift */,
				631411401D59797100E24B9E /* Infrastructure.h */,
				631411411D59797100E24B9E /* Infrastructure.m */,
				631411421D59797100E24B9E /* Infrastructure.swift */,
			);
			name = Bridging;
			path = Tests/Bridging;
			sourceTree = "<group>";
		};
		6317518A1D59765700A9DDDC /* Core */ = {
			isa = PBXGroup;
			children = (
				9E4170FA287D8DBD00A3B4B5 /* AsyncTests.swift */,
				9EC774282991497900803027 /* CombineTests.swift */,
				63CF6D7F203CD19200EC8927 /* ThenableTests.swift */,
				632FBBE41F33B338008F8FBB /* CatchableTests.swift */,
				635D64081D59635300BC0AF5 /* PromiseTests.swift */,
				49A5584B1DC5172F00E4D01B /* ResolverTests.swift */,
				63CF6D7B203CCDAB00EC8927 /* GuaranteeTests.swift */,
				635D64091D59635300BC0AF5 /* CancellableErrorTests.swift */,
				63CF6D79203CC66000EC8927 /* ErrorTests.swift */,
				635D64151D59635300BC0AF5 /* WhenTests.swift */,
				635D64131D59635300BC0AF5 /* WhenConcurrentTests.swift */,
				635D64111D59635300BC0AF5 /* WhenResolvedTests.swift */,
				635D640E1D59635300BC0AF5 /* AfterTests.swift */,
				0C42F3191FCF86240051309C /* HangTests.swift */,
				635D64121D59635300BC0AF5 /* RaceTests.swift */,
				635D641B1D59635300BC0AF5 /* DefaultDispatchQueueTests.swift */,
				635D64171D59635300BC0AF5 /* RegressionTests.swift */,
				635D64161D59635300BC0AF5 /* StressTests.swift */,
				635D640D1D59635300BC0AF5 /* ZalgoTests.swift */,
				639BF755203DF02C00FA577B /* Utilities.swift */,
				085B96B121A6358900E5E22F /* LoggingTests.swift */,
			);
			name = Core;
			path = Tests/CorePromise;
			sourceTree = "<group>";
		};
		631751AA1D59768200A9DDDC /* A+ */ = {
			isa = PBXGroup;
			children = (
				631751AB1D59768200A9DDDC /* 0.0.0.swift */,
				631751AC1D59768200A9DDDC /* 2.1.2.swift */,
				631751AD1D59768200A9DDDC /* 2.1.3.swift */,
				631751AE1D59768200A9DDDC /* 2.2.2.swift */,
				631751AF1D59768200A9DDDC /* 2.2.3.swift */,
				631751B01D59768200A9DDDC /* 2.2.4.swift */,
				631751B11D59768200A9DDDC /* 2.2.6.swift */,
				631751B21D59768200A9DDDC /* 2.2.7.swift */,
				631751B31D59768200A9DDDC /* 2.3.1.swift */,
				631751B41D59768200A9DDDC /* 2.3.2.swift */,
				631751B51D59768200A9DDDC /* 2.3.4.swift */,
				631751B61D59768200A9DDDC /* README.md */,
			);
			name = "A+";
			path = "Tests/A+";
			sourceTree = "<group>";
		};
		635893991D5BE51700F14B55 /* … */ = {
			isa = PBXGroup;
			children = (
				63B0AC581D595E1B00FA21D9 /* Products */,
				63B0AC6C1D595E6300FA21D9 /* Info.plist */,
				635893941D5BE4F900F14B55 /* LICENSE */,
				635893951D5BE4F900F14B55 /* Package.swift */,
				1F1DCDF72A27AB6400E7A16B /* PromiseKit.podspec */,
			);
			name = "…";
			sourceTree = "<group>";
		};
		635D64061D59630200BC0AF5 /* Tests */ = {
			isa = PBXGroup;
			children = (
				C0244E6B2047ACAF00ACB4AC /* JS/A+ */,
				631751AA1D59768200A9DDDC /* A+ */,
				6314113D1D59797100E24B9E /* Bridging */,
				6317518A1D59765700A9DDDC /* Core */,
				630A8050203CEF6800D25F23 /* CoreObjC */,
				63648C94203CB97400EBA011 /* DeprecationTests.swift */,
			);
			name = Tests;
			sourceTree = "<group>";
		};
		6399A3711D595D9100D65233 = {
			isa = PBXGroup;
			children = (
				635893971D5BE4F900F14B55 /* README.md */,
				635893921D5BE4E000F14B55 /* PromiseKit.playground */,
				63B0AC761D595E6300FA21D9 /* PromiseKit.h */,
				63B0AC601D595E4C00FA21D9 /* Sources.swift */,
				63B912AB1F1E657400D49110 /* Sources.objc */,
				635D64061D59630200BC0AF5 /* Tests */,
				635893991D5BE51700F14B55 /* … */,
			);
			sourceTree = "<group>";
		};
		63B0AC581D595E1B00FA21D9 /* Products */ = {
			isa = PBXGroup;
			children = (
				63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */,
				630019221D596292003B4E30 /* PMKCoreTests.xctest */,
				631751A81D59766500A9DDDC /* PMKA+Tests.xctest */,
				6314113C1D59795700E24B9E /* PMKBridgeTests.xctest */,
				633027EA203CC0060037E136 /* PMKDeprecatedTests.xctest */,
				C0244E622047A6CB00ACB4AC /* PMKJSA+Tests.xctest */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		63B0AC601D595E4C00FA21D9 /* Sources.swift */ = {
			isa = PBXGroup;
			children = (
				9E4170F8287D88C800A3B4B5 /* Async.swift */,
				9EC774262991495C00803027 /* Combine.swift */,
				636A29191F1C156B001229C2 /* Promise.swift */,
				636A29221F1C17A6001229C2 /* Guarantee.swift */,
				636A29201F1C1716001229C2 /* Thenable.swift */,
				632FBBE21F33B273008F8FBB /* Catchable.swift */,
				63B912AC1F1E663E00D49110 /* Features */,
				63B0AC691D595E6300FA21D9 /* Error.swift */,
				636A29261F1C3927001229C2 /* Resolver.swift */,
				636A291E1F1C16FF001229C2 /* Box.swift */,
				6330B5E01F2E991200D60528 /* Configuration.swift */,
				63B18AEB1F2D205C00B79E37 /* CustomStringConvertible.swift */,
				63D9B2F020338D5D0075C00B /* Deprecations.swift */,
				085B96BE21A9B37C00E5E22F /* LogEvent.swift */,
				9E8028F82BDCEDBC0081E2D1 /* Resources */,
			);
			name = Sources.swift;
			sourceTree = "<group>";
		};
		63B0AC9D1D595E6E00FA21D9 /* Internal Utilities */ = {
			isa = PBXGroup;
			children = (
				63B0AC661D595E6300FA21D9 /* AnyPromise+Private.h */,
				63B0AC6F1D595E6300FA21D9 /* NSMethodSignatureForBlock.m */,
				63B0AC711D595E6300FA21D9 /* PMKCallVariadicBlock.m */,
			);
			name = "Internal Utilities";
			sourceTree = "<group>";
		};
		63B912AB1F1E657400D49110 /* Sources.objc */ = {
			isa = PBXGroup;
			children = (
				63B0AC641D595E6300FA21D9 /* AnyPromise.m */,
				63B0AC651D595E6300FA21D9 /* AnyPromise.swift */,
				63B0AC671D595E6300FA21D9 /* dispatch_promise.m */,
				630B60C01F2F73B000A1AEFE /* Headers */,
				630B60BF1F2F739E00A1AEFE /* Features */,
				63B0AC9D1D595E6E00FA21D9 /* Internal Utilities */,
			);
			name = Sources.objc;
			sourceTree = "<group>";
		};
		63B912AC1F1E663E00D49110 /* Features */ = {
			isa = PBXGroup;
			children = (
				0CC3AF2A1FCF84F7000E98C9 /* hang.swift */,
				63B0AC621D595E6300FA21D9 /* after.swift */,
				63B912A91F1D7B1300D49110 /* firstly.swift */,
				636A29241F1C3089001229C2 /* race.swift */,
				63B0AC7D1D595E6300FA21D9 /* when.swift */,
			);
			name = Features;
			sourceTree = "<group>";
		};
		9E8028F82BDCEDBC0081E2D1 /* Resources */ = {
			isa = PBXGroup;
			children = (
				9E8028F72BDCEDBC0081E2D1 /* PrivacyInfo.xcprivacy */,
			);
			name = Resources;
			path = Sources/Resources;
			sourceTree = "<group>";
		};
		C0244E6B2047ACAF00ACB4AC /* JS/A+ */ = {
			isa = PBXGroup;
			children = (
				C0244E682047AC9F00ACB4AC /* AllTests.swift */,
				C013F7372048E3B6006B57B1 /* MockNodeEnvironment.swift */,
				C013F7392049076A006B57B1 /* JSPromise.swift */,
				C013F73B20494291006B57B1 /* JSAdapter.swift */,
				C013F73F204E5063006B57B1 /* JSUtils.swift */,
			);
			name = "JS/A+";
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
		63B0AC541D595E1B00FA21D9 /* Headers */ = {
			isa = PBXHeadersBuildPhase;
			buildActionMask = 2147483647;
			files = (
				63B0AC931D595E6300FA21D9 /* PromiseKit.h in Headers */,
				634AAD2B1EAE517C00B17855 /* fwd.h in Headers */,
				63B0AC811D595E6300FA21D9 /* AnyPromise.h in Headers */,
				63B0AC841D595E6300FA21D9 /* AnyPromise+Private.h in Headers */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
		630019011D596292003B4E30 /* PMKCoreTests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 6300191F1D596292003B4E30 /* Build configuration list for PBXNativeTarget "PMKCoreTests" */;
			buildPhases = (
				630019021D596292003B4E30 /* Sources */,
				630019181D596292003B4E30 /* Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
				635D64051D5962F900BC0AF5 /* PBXTargetDependency */,
			);
			name = PMKCoreTests;
			productName = PromiseKit;
			productReference = 630019221D596292003B4E30 /* PMKCoreTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		631411321D59795700E24B9E /* PMKBridgeTests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 631411391D59795700E24B9E /* Build configuration list for PBXNativeTarget "PMKBridgeTests" */;
			buildPhases = (
				631411351D59795700E24B9E /* Sources */,
				631411371D59795700E24B9E /* Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
				631411331D59795700E24B9E /* PBXTargetDependency */,
			);
			name = PMKBridgeTests;
			productName = PromiseKit;
			productReference = 6314113C1D59795700E24B9E /* PMKBridgeTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		6317518B1D59766500A9DDDC /* PMKA+Tests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 631751A51D59766500A9DDDC /* Build configuration list for PBXNativeTarget "PMKA+Tests" */;
			buildPhases = (
				6317518E1D59766500A9DDDC /* Sources */,
				631751A31D59766500A9DDDC /* Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
				6317518C1D59766500A9DDDC /* PBXTargetDependency */,
			);
			name = "PMKA+Tests";
			productName = PromiseKit;
			productReference = 631751A81D59766500A9DDDC /* PMKA+Tests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		633027E0203CC0060037E136 /* PMKDeprecatedTests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 633027E7203CC0060037E136 /* Build configuration list for PBXNativeTarget "PMKDeprecatedTests" */;
			buildPhases = (
				633027E3203CC0060037E136 /* Sources */,
				633027E5203CC0060037E136 /* Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
				633027E1203CC0060037E136 /* PBXTargetDependency */,
			);
			name = PMKDeprecatedTests;
			productName = PromiseKit;
			productReference = 633027EA203CC0060037E136 /* PMKDeprecatedTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
		63B0AC561D595E1B00FA21D9 /* PromiseKit */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 63B0AC5F1D595E1B00FA21D9 /* Build configuration list for PBXNativeTarget "PromiseKit" */;
			buildPhases = (
				63B0AC541D595E1B00FA21D9 /* Headers */,
				63B0AC521D595E1B00FA21D9 /* Sources */,
				63B0AC531D595E1B00FA21D9 /* Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = PromiseKit;
			productName = PromiseKit;
			productReference = 63B0AC571D595E1B00FA21D9 /* PromiseKit.framework */;
			productType = "com.apple.product-type.framework";
		};
		C0244E4E2047A6CB00ACB4AC /* PMKJSA+Tests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = C0244E5F2047A6CB00ACB4AC /* Build configuration list for PBXNativeTarget "PMKJSA+Tests" */;
			buildPhases = (
				C0244E512047A6CB00ACB4AC /* Sources */,
				C0244E5D2047A6CB00ACB4AC /* Frameworks */,
				C0244E6E2047AF0B00ACB4AC /* CopyFiles */,
			);
			buildRules = (
			);
			dependencies = (
				C0244E4F2047A6CB00ACB4AC /* PBXTargetDependency */,
			);
			name = "PMKJSA+Tests";
			productName = PromiseKit;
			productReference = C0244E622047A6CB00ACB4AC /* PMKJSA+Tests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		6399A3721D595D9100D65233 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 1250;
				TargetAttributes = {
					630019011D596292003B4E30 = {
						LastSwiftMigration = 1100;
					};
					631411321D59795700E24B9E = {
						LastSwiftMigration = 1100;
					};
					6317518B1D59766500A9DDDC = {
						LastSwiftMigration = 1100;
					};
					633027E0203CC0060037E136 = {
						LastSwiftMigration = 1100;
					};
					63B0AC561D595E1B00FA21D9 = {
						CreatedOnToolsVersion = 8.0;
						LastSwiftMigration = 1100;
						ProvisioningStyle = Automatic;
					};
					C0244E4E2047A6CB00ACB4AC = {
						LastSwiftMigration = 1100;
					};
				};
			};
			buildConfigurationList = 6399A3751D595D9100D65233 /* Build configuration list for PBXProject "PromiseKit" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = en;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = 6399A3711D595D9100D65233;
			productRefGroup = 63B0AC581D595E1B00FA21D9 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				63B0AC561D595E1B00FA21D9 /* PromiseKit */,
				6317518B1D59766500A9DDDC /* PMKA+Tests */,
				631411321D59795700E24B9E /* PMKBridgeTests */,
				630019011D596292003B4E30 /* PMKCoreTests */,
				633027E0203CC0060037E136 /* PMKDeprecatedTests */,
				C0244E4E2047A6CB00ACB4AC /* PMKJSA+Tests */,
			);
		};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
		630019021D596292003B4E30 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				0C42F31B1FCF86320051309C /* HangTests.swift in Sources */,
				635D641E1D59635300BC0AF5 /* CancellableErrorTests.swift in Sources */,
				630A8056203CEF6800D25F23 /* AnyPromiseTests.m in Sources */,
				635D64221D59635300BC0AF5 /* ZalgoTests.swift in Sources */,
				635D64271D59635300BC0AF5 /* RaceTests.swift in Sources */,
				9EC7742A2991498200803027 /* CombineTests.swift in Sources */,
				632FBBE51F33B338008F8FBB /* CatchableTests.swift in Sources */,
				63CF6D80203CD19200EC8927 /* ThenableTests.swift in Sources */,
				635D642B1D59635300BC0AF5 /* StressTests.swift in Sources */,
				630A805A203CEF6800D25F23 /* WhenTests.m in Sources */,
				630A805B203CF67800D25F23 /* DefaultDispatchQueueTests.swift in Sources */,
				635D641D1D59635300BC0AF5 /* PromiseTests.swift in Sources */,
				63CF6D7C203CCDAB00EC8927 /* GuaranteeTests.swift in Sources */,
				9E66231626FE5A8C00FA25CB /* RaceTests.m in Sources */,
				639BF757203DF03100FA577B /* Utilities.swift in Sources */,
				9E4170FC287D8DF900A3B4B5 /* AsyncTests.swift in Sources */,
				635D64261D59635300BC0AF5 /* WhenResolvedTests.swift in Sources */,
				635D64231D59635300BC0AF5 /* AfterTests.swift in Sources */,
				63CF6D7A203CC66000EC8927 /* ErrorTests.swift in Sources */,
				49A5584D1DC5185900E4D01B /* ResolverTests.swift in Sources */,
				630A8057203CEF6800D25F23 /* PMKManifoldTests.m in Sources */,
				085B96B321A6359500E5E22F /* LoggingTests.swift in Sources */,
				63B7C94B203E2B8200FBEC00 /* AnyPromiseTests.swift in Sources */,
				630A8059203CEF6800D25F23 /* HangTests.m in Sources */,
				635D642A1D59635300BC0AF5 /* WhenTests.swift in Sources */,
				630A8058203CEF6800D25F23 /* JoinTests.m in Sources */,
				635D64281D59635300BC0AF5 /* WhenConcurrentTests.swift in Sources */,
				635D642C1D59635300BC0AF5 /* RegressionTests.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		631411351D59795700E24B9E /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				631411461D59797100E24B9E /* Infrastructure.swift in Sources */,
				631411431D59797100E24B9E /* BridgingTests.m in Sources */,
				631411441D59797100E24B9E /* BridgingTests.swift in Sources */,
				631411451D59797100E24B9E /* Infrastructure.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		6317518E1D59766500A9DDDC /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				631751C11D59768200A9DDDC /* 2.3.4.swift in Sources */,
				631751BA1D59768200A9DDDC /* 2.2.2.swift in Sources */,
				631751BF1D59768200A9DDDC /* 2.3.1.swift in Sources */,
				631751B91D59768200A9DDDC /* 2.1.3.swift in Sources */,
				631751BD1D59768200A9DDDC /* 2.2.6.swift in Sources */,
				631751B71D59768200A9DDDC /* 0.0.0.swift in Sources */,
				631751C01D59768200A9DDDC /* 2.3.2.swift in Sources */,
				631751B81D59768200A9DDDC /* 2.1.2.swift in Sources */,
				631751BE1D59768200A9DDDC /* 2.2.7.swift in Sources */,
				631751BC1D59768200A9DDDC /* 2.2.4.swift in Sources */,
				631751BB1D59768200A9DDDC /* 2.2.3.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		633027E3203CC0060037E136 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				63CF6D7E203CD12700EC8927 /* DeprecationTests.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		63B0AC521D595E1B00FA21D9 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				636A29251F1C3089001229C2 /* race.swift in Sources */,
				63B0AC9A1D595E6300FA21D9 /* when.swift in Sources */,
				636A29271F1C3927001229C2 /* Resolver.swift in Sources */,
				63B0AC991D595E6300FA21D9 /* when.m in Sources */,
				63D9B2EF203385FD0075C00B /* race.m in Sources */,
				63B0AC801D595E6300FA21D9 /* after.swift in Sources */,
				63B18AEC1F2D205C00B79E37 /* CustomStringConvertible.swift in Sources */,
				085B96BF21A9B37C00E5E22F /* LogEvent.swift in Sources */,
				9E4170F9287D88C900A3B4B5 /* Async.swift in Sources */,
				6330B5E11F2E991200D60528 /* Configuration.swift in Sources */,
				63B912AA1F1D7B1300D49110 /* firstly.swift in Sources */,
				636A29211F1C1716001229C2 /* Thenable.swift in Sources */,
				632FBBE31F33B273008F8FBB /* Catchable.swift in Sources */,
				63B0AC851D595E6300FA21D9 /* dispatch_promise.m in Sources */,
				636A291F1F1C16FF001229C2 /* Box.swift in Sources */,
				63B0AC821D595E6300FA21D9 /* AnyPromise.m in Sources */,
				636A29231F1C17A6001229C2 /* Guarantee.swift in Sources */,
				636A291A1F1C156B001229C2 /* Promise.swift in Sources */,
				63B0AC8B1D595E6300FA21D9 /* join.m in Sources */,
				63B0AC891D595E6300FA21D9 /* hang.m in Sources */,
				63B0AC831D595E6300FA21D9 /* AnyPromise.swift in Sources */,
				9EC774272991495C00803027 /* Combine.swift in Sources */,
				63D9B2F120338D5D0075C00B /* Deprecations.swift in Sources */,
				63B0AC871D595E6300FA21D9 /* Error.swift in Sources */,
				0CC3AF2B1FCF84F7000E98C9 /* hang.swift in Sources */,
				63B0AC7F1D595E6300FA21D9 /* after.m in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C0244E512047A6CB00ACB4AC /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				C013F73C20494291006B57B1 /* JSAdapter.swift in Sources */,
				C0244E692047AC9F00ACB4AC /* AllTests.swift in Sources */,
				C013F740204E5064006B57B1 /* JSUtils.swift in Sources */,
				C013F73A2049076A006B57B1 /* JSPromise.swift in Sources */,
				C013F7382048E3B6006B57B1 /* MockNodeEnvironment.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
		631411331D59795700E24B9E /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 63B0AC561D595E1B00FA21D9 /* PromiseKit */;
			targetProxy = 631411341D59795700E24B9E /* PBXContainerItemProxy */;
		};
		6317518C1D59766500A9DDDC /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 63B0AC561D595E1B00FA21D9 /* PromiseKit */;
			targetProxy = 6317518D1D59766500A9DDDC /* PBXContainerItemProxy */;
		};
		633027E1203CC0060037E136 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 63B0AC561D595E1B00FA21D9 /* PromiseKit */;
			targetProxy = 633027E2203CC0060037E136 /* PBXContainerItemProxy */;
		};
		635D64051D5962F900BC0AF5 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 63B0AC561D595E1B00FA21D9 /* PromiseKit */;
			targetProxy = 635D64041D5962F900BC0AF5 /* PBXContainerItemProxy */;
		};
		C0244E4F2047A6CB00ACB4AC /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 63B0AC561D595E1B00FA21D9 /* PromiseKit */;
			targetProxy = C0244E502047A6CB00ACB4AC /* PBXContainerItemProxy */;
		};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
		630019201D596292003B4E30 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
			};
			name = Debug;
		};
		630019211D596292003B4E30 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
			};
			name = Release;
		};
		6314113A1D59795700E24B9E /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
				SWIFT_OBJC_BRIDGING_HEADER = Tests/Bridging/Infrastructure.h;
			};
			name = Debug;
		};
		6314113B1D59795700E24B9E /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
				SWIFT_OBJC_BRIDGING_HEADER = Tests/Bridging/Infrastructure.h;
			};
			name = Release;
		};
		631751A61D59766500A9DDDC /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
			};
			name = Debug;
		};
		631751A71D59766500A9DDDC /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				SWIFT_INSTALL_OBJC_HEADER = NO;
			};
			name = Release;
		};
		633027E8203CC0060037E136 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_INSTALL_OBJC_HEADER = NO;
				SWIFT_SUPPRESS_WARNINGS = YES;
			};
			name = Debug;
		};
		633027E9203CC0060037E136 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_INSTALL_OBJC_HEADER = NO;
				SWIFT_SUPPRESS_WARNINGS = YES;
			};
			name = Release;
		};
		6399A3761D595D9100D65233 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = NO;
				CURRENT_PROJECT_VERSION = 8.2.0;
				DEBUG_INFORMATION_FORMAT = dwarf;
				DYLIB_COMPATIBILITY_VERSION = 1;
				DYLIB_CURRENT_VERSION = 1;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				LD_DYLIB_INSTALL_NAME = "@rpath";
				MACOSX_DEPLOYMENT_TARGET = 10.13;
				ONLY_ACTIVE_ARCH = YES;
				PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
				PRODUCT_BUNDLE_PACKAGE_TYPE = BNDL;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos watchsimulator iphonesimulator watchos iphoneos";
				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
				SWIFT_VERSION = 4.0;
				TVOS_DEPLOYMENT_TARGET = 11.0;
				VERSIONING_SYSTEM = "apple-generic";
				WATCHOS_DEPLOYMENT_TARGET = 4.0;
				XROS_DEPLOYMENT_TARGET = 1.0;
			};
			name = Debug;
		};
		6399A3771D595D9100D65233 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = NO;
				CURRENT_PROJECT_VERSION = 8.2.0;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				DYLIB_COMPATIBILITY_VERSION = 1;
				DYLIB_CURRENT_VERSION = 1;
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				LD_DYLIB_INSTALL_NAME = "@rpath";
				MACOSX_DEPLOYMENT_TARGET = 10.13;
				PRODUCT_BUNDLE_IDENTIFIER = org.promisekit;
				PRODUCT_BUNDLE_PACKAGE_TYPE = BNDL;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SUPPORTED_PLATFORMS = "macosx appletvsimulator appletvos watchsimulator iphonesimulator watchos iphoneos";
				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
				SWIFT_VERSION = 4.0;
				TVOS_DEPLOYMENT_TARGET = 11.0;
				VERSIONING_SYSTEM = "apple-generic";
				WATCHOS_DEPLOYMENT_TARGET = 4.0;
				XROS_DEPLOYMENT_TARGET = 1.0;
			};
			name = Release;
		};
		63B0AC5D1D595E1B00FA21D9 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				APPLICATION_EXTENSION_API_ONLY = YES;
				CLANG_WARN_ASSIGN_ENUM = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_CXX0X_EXTENSIONS = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
				CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
				CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
				CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
				CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES;
				DEFINES_MODULE = YES;
				DYLIB_INSTALL_NAME_BASE = "@rpath";
				ENABLE_TESTABILITY = YES;
				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
				GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
				GCC_WARN_SIGN_COMPARE = YES;
				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNKNOWN_PRAGMAS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_LABEL = YES;
				GCC_WARN_UNUSED_PARAMETER = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
				SKIP_INSTALL = YES;
				SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)";
				SUPPORTS_MACCATALYST = YES;
				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
				SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
				TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
			};
			name = Debug;
		};
		63B0AC5E1D595E1B00FA21D9 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				APPLICATION_EXTENSION_API_ONLY = YES;
				BITCODE_GENERATION_MODE = bitcode;
				CLANG_WARN_ASSIGN_ENUM = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_CXX0X_EXTENSIONS = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
				CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
				CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
				CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
				CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES;
				DEFINES_MODULE = YES;
				DYLIB_INSTALL_NAME_BASE = "@rpath";
				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
				GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
				GCC_TREAT_WARNINGS_AS_ERRORS = NO;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
				GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
				GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
				GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
				GCC_WARN_SIGN_COMPARE = YES;
				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNKNOWN_PRAGMAS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_LABEL = YES;
				GCC_WARN_UNUSED_PARAMETER = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				PRODUCT_BUNDLE_PACKAGE_TYPE = FMWK;
				SKIP_INSTALL = YES;
				SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)";
				SUPPORTS_MACCATALYST = YES;
				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
				SWIFT_TREAT_WARNINGS_AS_ERRORS = NO;
				TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
			};
			name = Release;
		};
		C0244E602047A6CB00ACB4AC /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				CLANG_ENABLE_MODULES = YES;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_INSTALL_OBJC_HEADER = NO;
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
			name = Debug;
		};
		C0244E612047A6CB00ACB4AC /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				CLANG_ENABLE_MODULES = YES;
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks @loader_path/Frameworks";
				"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_INSTALL_OBJC_HEADER = NO;
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		6300191F1D596292003B4E30 /* Build configuration list for PBXNativeTarget "PMKCoreTests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				630019201D596292003B4E30 /* Debug */,
				630019211D596292003B4E30 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		631411391D59795700E24B9E /* Build configuration list for PBXNativeTarget "PMKBridgeTests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				6314113A1D59795700E24B9E /* Debug */,
				6314113B1D59795700E24B9E /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		631751A51D59766500A9DDDC /* Build configuration list for PBXNativeTarget "PMKA+Tests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				631751A61D59766500A9DDDC /* Debug */,
				631751A71D59766500A9DDDC /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		633027E7203CC0060037E136 /* Build configuration list for PBXNativeTarget "PMKDeprecatedTests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				633027E8203CC0060037E136 /* Debug */,
				633027E9203CC0060037E136 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		6399A3751D595D9100D65233 /* Build configuration list for PBXProject "PromiseKit" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				6399A3761D595D9100D65233 /* Debug */,
				6399A3771D595D9100D65233 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		63B0AC5F1D595E1B00FA21D9 /* Build configuration list for PBXNativeTarget "PromiseKit" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				63B0AC5D1D595E1B00FA21D9 /* Debug */,
				63B0AC5E1D595E1B00FA21D9 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		C0244E5F2047A6CB00ACB4AC /* Build configuration list for PBXNativeTarget "PMKJSA+Tests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				C0244E602047A6CB00ACB4AC /* Debug */,
				C0244E612047A6CB00ACB4AC /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
	};
	rootObject = 6399A3721D595D9100D65233 /* Project object */;
}


================================================
FILE: PromiseKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:">
   </FileRef>
</Workspace>


================================================
FILE: PromiseKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>IDEDidComputeMac32BitWarning</key>
	<true/>
</dict>
</plist>


================================================
FILE: PromiseKit.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
	<false/>
</dict>
</plist>


================================================
FILE: PromiseKit.xcodeproj/xcshareddata/xcschemes/PromiseKit.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "1250"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "NO">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "NO"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "63B0AC561D595E1B00FA21D9"
               BuildableName = "PromiseKit.framework"
               BlueprintName = "PromiseKit"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES"
      codeCoverageEnabled = "YES"
      onlyGenerateCoverageForSpecifiedTargets = "YES">
      <CodeCoverageTargets>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "63B0AC561D595E1B00FA21D9"
            BuildableName = "PromiseKit.framework"
            BlueprintName = "PromiseKit"
            ReferencedContainer = "container:PromiseKit.xcodeproj">
         </BuildableReference>
      </CodeCoverageTargets>
      <Testables>
         <TestableReference
            skipped = "NO"
            parallelizable = "YES"
            testExecutionOrdering = "random">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "630019011D596292003B4E30"
               BuildableName = "PMKCoreTests.xctest"
               BlueprintName = "PMKCoreTests"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </TestableReference>
         <TestableReference
            skipped = "NO"
            parallelizable = "YES"
            testExecutionOrdering = "random">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "6317518B1D59766500A9DDDC"
               BuildableName = "PMKA+Tests.xctest"
               BlueprintName = "PMKA+Tests"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </TestableReference>
         <TestableReference
            skipped = "NO"
            parallelizable = "YES"
            testExecutionOrdering = "random">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "631411321D59795700E24B9E"
               BuildableName = "PMKBridgeTests.xctest"
               BlueprintName = "PMKBridgeTests"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </TestableReference>
         <TestableReference
            skipped = "NO"
            parallelizable = "YES"
            testExecutionOrdering = "random">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "633027E0203CC0060037E136"
               BuildableName = "PMKDeprecatedTests.xctest"
               BlueprintName = "PMKDeprecatedTests"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </TestableReference>
         <TestableReference
            skipped = "NO"
            parallelizable = "YES"
            testExecutionOrdering = "random">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "C0244E4E2047A6CB00ACB4AC"
               BuildableName = "PMKJSA+Tests.xctest"
               BlueprintName = "PMKJSA+Tests"
               ReferencedContainer = "container:PromiseKit.xcodeproj">
            </BuildableReference>
         </TestableReference>
      </Testables>
   </TestAction>
   <LaunchAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      debugServiceExtension = "internal"
      allowLocationSimulation = "YES">
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "63B0AC561D595E1B00FA21D9"
            BuildableName = "PromiseKit.framework"
            BlueprintName = "PromiseKit"
            ReferencedContainer = "container:PromiseKit.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
   </LaunchAction>
   <ProfileAction
      buildConfiguration = "Release"
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      debugDocumentVersioning = "YES">
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "63B0AC561D595E1B00FA21D9"
            BuildableName = "PromiseKit.framework"
            BlueprintName = "PromiseKit"
            ReferencedContainer = "container:PromiseKit.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>


================================================
FILE: README.md
================================================
![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-promisekit&utm_medium=referral&utm_campaign=readme).


# Documentation

* Handbook
  * [Getting Started](Documentation/GettingStarted.md)
  * [Promises: Common Patterns](Documentation/CommonPatterns.md)
  * [Frequently Asked Questions](Documentation/FAQ.md)
* Manual
  * [Installation Guide](Documentation/Installation.md)
  * [Objective-C Guide](Documentation/ObjectiveC.md)
  * [Troubleshooting](Documentation/Troubleshooting.md) (e.g., solutions to common compile errors)
  * [Appendix](Documentation/Appendix.md)
* [API Reference](https://mxcl.dev/PromiseKit/reference/v6/Classes/Promise.html)

# Extensions

Promises are only as useful as the asynchronous tasks they represent. Thus, we
have converted (almost) all of Apple’s APIs to promises. The default CocoaPod
provides Promises and the extensions for Foundation and UIKit. The other
extensions are available by specifying additional subspecs in your `Podfile`,
e.g.:

```ruby
pod "PromiseKit/MapKit"          # MKDirections().calculate().then { /*…*/ }
pod "PromiseKit/CoreLocation"    # CLLocationManager.requestLocation().then { /*…*/ }
```

All our extensions are separate repositories at the [PromiseKit organization].

## I don't want the extensions!

Then don’t have them:

```ruby
pod "PromiseKit/CorePromise", "~> 8"
```

> *Note:* Carthage installations come with no extensions by default.

## Networking

Promise chains commonly start with a network operation. Thus, we offer
extensions for `URLSession`:

```swift
// pod 'PromiseKit/Foundation'  # https://github.com/PromiseKit/Foundation

firstly {
    URLSession.shared.dataTask(.promise, with: try makeUrlRequest()).validate()
    // ^^ we provide `.validate()` so that eg. 404s get converted to errors
}.map {
    try JSONDecoder().decode(Foo.self, with: $0.data)
}.done { foo in
    //…
}.catch { error in
    //…
}

func makeUrlRequest() throws -> URLRequest {
    var rq = URLRequest(url: url)
    rq.httpMethod = "POST"
    rq.addValue("application/json", forHTTPHeaderField: "Content-Type")
    rq.addValue("application/json", forHTTPHeaderField: "Accept")
    rq.httpBody = try JSONEncoder().encode(obj)
    return rq
}
```

Support for Alamofire is welcome, please submit a PR.


# Support

Please check our [Troubleshooting Guide](Documentation/Troubleshooting.md), and
if after that you still have a question, ask at our [Gitter chat channel] or on [our bug tracker].

## Security & Vulnerability Reporting or Disclosure

https://tidelift.com/security


[badge-pod]: https://img.shields.io/cocoapods/v/PromiseKit.svg?label=version
[badge-pms]: https://img.shields.io/badge/supports-CocoaPods%20%7C%20Carthage%20%7C%20Accio%20%7C%20SwiftPM-green.svg
[badge-languages]: https://img.shields.io/badge/languages-Swift%20%7C%20ObjC-orange.svg
[badge-platforms]: https://img.shields.io/badge/platforms-macOS%20%7C%20iOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-lightgrey.svg
[badge-mit]: https://img.shields.io/badge/license-MIT-blue.svg
[OMGHTTPURLRQ]: https://github.com/PromiseKit/OMGHTTPURLRQ
[Alamofire]: http://github.com/PromiseKit/Alamofire-
[PromiseKit organization]: https://github.com/PromiseKit
[Gitter chat channel]: https://gitter.im/mxcl/PromiseKit
[our bug tracker]: https://github.com/mxcl/PromiseKit/issues/new
[Podfile]: https://guides.cocoapods.org/syntax/podfile.html
[PMK6]: http://mxcl.dev/PromiseKit/news/2018/02/PromiseKit-6.0-Released/
[Installation Guide]: Documentation/Installation.md
[badge-travis]: https://travis-ci.org/mxcl/PromiseKit.svg?branch=master
[travis]: https://travis-ci.org/mxcl/PromiseKit
[cocoapods]: https://cocoapods.org/pods/PromiseKit


================================================
FILE: Sources/AnyPromise+Private.h
================================================
@import Foundation.NSError;
@import Foundation.NSPointerArray;

#if TARGET_OS_IPHONE
    #define NSPointerArrayMake(N) ({ \
        NSPointerArray *aa = [NSPointerArray strongObjectsPointerArray]; \
        aa.count = N; \
        aa; \
    })
#else
    static inline NSPointerArray * __nonnull NSPointerArrayMake(NSUInteger count) {
      #pragma clang diagnostic push
      #pragma clang diagnostic ignored "-Wdeprecated-declarations"
        NSPointerArray *aa = [[NSPointerArray class] respondsToSelector:@selector(
Download .txt
gitextract_8yos49k1/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── LinuxMain.stencil
│   ├── codecov.yml
│   ├── jazzy.yml
│   ├── ranger.yml
│   ├── sourcery.yml
│   └── workflows/
│       ├── cd.yml
│       ├── ci-podspec.yml
│       ├── ci.yml
│       └── publish.yml
├── .gitignore
├── .gitmodules
├── .tidelift.yml
├── .travis.yml
├── Documentation/
│   ├── Appendix.md
│   ├── CommonPatterns.md
│   ├── Examples/
│   │   ├── ImageCache.md
│   │   ├── URLSession+BadResponseErrors.swift
│   │   └── detweet.swift
│   ├── FAQ.md
│   ├── GettingStarted.md
│   ├── Installation.md
│   ├── ObjectiveC.md
│   ├── README.md
│   └── Troubleshooting.md
├── LICENSE
├── Package.swift
├── Package@swift-4.2.swift
├── Package@swift-5.0.swift
├── Package@swift-5.3.swift
├── PromiseKit.playground/
│   ├── Contents.swift
│   ├── contents.xcplayground
│   └── playground.xcworkspace/
│       └── contents.xcworkspacedata
├── PromiseKit.podspec
├── PromiseKit.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   └── xcshareddata/
│   │       ├── IDEWorkspaceChecks.plist
│   │       └── WorkspaceSettings.xcsettings
│   └── xcshareddata/
│       └── xcschemes/
│           └── PromiseKit.xcscheme
├── README.md
├── Sources/
│   ├── AnyPromise+Private.h
│   ├── AnyPromise.h
│   ├── AnyPromise.m
│   ├── AnyPromise.swift
│   ├── Async.swift
│   ├── Box.swift
│   ├── Catchable.swift
│   ├── Combine.swift
│   ├── Configuration.swift
│   ├── CustomStringConvertible.swift
│   ├── Deprecations.swift
│   ├── Error.swift
│   ├── Guarantee.swift
│   ├── Info.plist
│   ├── LogEvent.swift
│   ├── NSMethodSignatureForBlock.m
│   ├── PMKCallVariadicBlock.m
│   ├── Promise.swift
│   ├── PromiseKit.h
│   ├── Resolver.swift
│   ├── Resources/
│   │   └── PrivacyInfo.xcprivacy
│   ├── Thenable.swift
│   ├── after.m
│   ├── after.swift
│   ├── dispatch_promise.m
│   ├── firstly.swift
│   ├── fwd.h
│   ├── hang.m
│   ├── hang.swift
│   ├── join.m
│   ├── race.m
│   ├── race.swift
│   ├── when.m
│   └── when.swift
├── Tests/
│   ├── A+/
│   │   ├── 0.0.0.swift
│   │   ├── 2.1.2.swift
│   │   ├── 2.1.3.swift
│   │   ├── 2.2.2.swift
│   │   ├── 2.2.3.swift
│   │   ├── 2.2.4.swift
│   │   ├── 2.2.6.swift
│   │   ├── 2.2.7.swift
│   │   ├── 2.3.1.swift
│   │   ├── 2.3.2.swift
│   │   ├── 2.3.4.swift
│   │   ├── README.md
│   │   └── XCTestManifests.swift
│   ├── Bridging/
│   │   ├── BridgingTests.m
│   │   ├── BridgingTests.swift
│   │   ├── Infrastructure.h
│   │   ├── Infrastructure.m
│   │   └── Infrastructure.swift
│   ├── CoreObjC/
│   │   ├── AnyPromiseTests.m
│   │   ├── AnyPromiseTests.swift
│   │   ├── HangTests.m
│   │   ├── JoinTests.m
│   │   ├── PMKManifoldTests.m
│   │   ├── RaceTests.m
│   │   └── WhenTests.m
│   ├── CorePromise/
│   │   ├── AfterTests.swift
│   │   ├── AsyncTests.swift
│   │   ├── CancellableErrorTests.swift
│   │   ├── CatchableTests.swift
│   │   ├── CombineTests.swift
│   │   ├── DefaultDispatchQueueTests.swift
│   │   ├── ErrorTests.swift
│   │   ├── GuaranteeTests.swift
│   │   ├── HangTests.swift
│   │   ├── LoggingTests.swift
│   │   ├── PromiseTests.swift
│   │   ├── RaceTests.swift
│   │   ├── RegressionTests.swift
│   │   ├── ResolverTests.swift
│   │   ├── StressTests.swift
│   │   ├── ThenableTests.swift
│   │   ├── Utilities.swift
│   │   ├── WhenConcurrentTests.swift
│   │   ├── WhenResolvedTests.swift
│   │   ├── WhenTests.swift
│   │   ├── XCTestManifests.swift
│   │   └── ZalgoTests.swift
│   ├── DeprecationTests.swift
│   ├── JS-A+/
│   │   ├── .gitignore
│   │   ├── AllTests.swift
│   │   ├── JSAdapter.swift
│   │   ├── JSPromise.swift
│   │   ├── JSUtils.swift
│   │   ├── MockNodeEnvironment.swift
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── package.json
│   │   └── webpack.config.js
│   └── LinuxMain.swift
└── tea.yaml
Download .txt
SYMBOL INDEX (1 symbols across 1 files)

FILE: Sources/AnyPromise+Private.h
  function NSPointerArray (line 11) | static inline NSPointerArray * __nonnull NSPointerArrayMake(NSUInteger c...
Condensed preview — 135 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (589K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 62,
    "preview": "tidelift: \"cocoapods/PromiseKit\"\npatreon: \"mxcl\"\ngithub: mxcl\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 733,
    "preview": "[PLEASE READ THE TROUBLESHOOTING GUIDE](https://github.com/mxcl/PromiseKit/blob/master/Documentation/Troubleshooting.md)"
  },
  {
    "path": ".github/LinuxMain.stencil",
    "chars": 759,
    "preview": "@testable import Core\n@testable import A_\nimport XCTest\n\n//TODO get this to run on CI and don’t have it committed\n//NOTE"
  },
  {
    "path": ".github/codecov.yml",
    "chars": 400,
    "preview": "ignore:\n  - \"Tests\"\n  - \"README.md\"\n  - \"Documentation\"\n  - \".travis.yml\"\n\ncodecov:\n  notify:\n    require_ci_to_pass: ye"
  },
  {
    "path": ".github/jazzy.yml",
    "chars": 341,
    "preview": "module: PromiseKit\ncustom_categories:\n  - name: Core Components\n    children:\n      - Promise\n      - Guarantee\n      - "
  },
  {
    "path": ".github/ranger.yml",
    "chars": 34,
    "preview": "merges:\n  - action: delete_branch\n"
  },
  {
    "path": ".github/sourcery.yml",
    "chars": 230,
    "preview": "sources:\n  include:\n    - ../Tests/A+\n    - ../Tests/CorePromise\n  exclude:\n    - ../Tests/A+/0.0.0.swift\n    - ../Tests"
  },
  {
    "path": ".github/workflows/cd.yml",
    "chars": 3545,
    "preview": "name: CD\non:\n  workflow_dispatch:\n    inputs:\n      version:\n        required: true\njobs:\n  pods:\n    runs-on: macos-lat"
  },
  {
    "path": ".github/workflows/ci-podspec.yml",
    "chars": 408,
    "preview": "on:\n  workflow_dispatch:\n  pull_request:\n    paths:\n      - PromiseKit.podspec\njobs:\n  lint:\n    runs-on: macos-15\n    s"
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 2747,
    "preview": "name: CI\n\non:\n  workflow_dispatch:\n  workflow_call:\n  pull_request:\n    paths:\n      - Sources/**\n      - Tests/**\n     "
  },
  {
    "path": ".github/workflows/publish.yml",
    "chars": 1975,
    "preview": "name: Publish\n\non:\n  workflow_dispatch:\n    inputs:\n      version:\n        description: semantic version to publish\n    "
  },
  {
    "path": ".gitignore",
    "chars": 134,
    "preview": "*.xcodeproj/**/xcuserdata/\n*.xcscmblueprint\n/Carthage\n/.build\n.DS_Store\nDerivedData\n/Extensions/Carthage\n/Tests/JS-A+/bu"
  },
  {
    "path": ".gitmodules",
    "chars": 2679,
    "preview": "[submodule \"Extensions/Foundation\"]\n\tpath = Extensions/Foundation\n\turl = https://github.com/PromiseKit/Foundation.git\n[s"
  },
  {
    "path": ".tidelift.yml",
    "chars": 36,
    "preview": "extra_ignore_directories: [ Tests ]\n"
  },
  {
    "path": ".travis.yml",
    "chars": 653,
    "preview": "os: osx\nlanguage: swift\nosx_image: xcode9.4\n\nif: tag =~ /^[0-9]+\\.[0-9]+\\.[0-9]+/\n\nstages:\n  - swiftpm\n  - carthage\n\njob"
  },
  {
    "path": "Documentation/Appendix.md",
    "chars": 5240,
    "preview": "# Common Misusage\n\n## Doubling up Promises\n\nDon’t do this:\n\n```swift\nfunc toggleNetworkSpinnerWithPromise<T>(funcToCall:"
  },
  {
    "path": "Documentation/CommonPatterns.md",
    "chars": 12946,
    "preview": "# Common Patterns\n\nOne feature of promises that makes them particularly useful is that they are composable.\nThis fact en"
  },
  {
    "path": "Documentation/Examples/ImageCache.md",
    "chars": 3517,
    "preview": "# Image Cache with Promises\n\nHere is an example of a simple image cache that uses promises to simplify the\nstate machine"
  },
  {
    "path": "Documentation/Examples/URLSession+BadResponseErrors.swift",
    "chars": 599,
    "preview": "Promise(.pending) { seal in\n    URLSession.shared.dataTask(with: rq, completionHandler: { data, rsp, error in\n        if"
  },
  {
    "path": "Documentation/Examples/detweet.swift",
    "chars": 3081,
    "preview": "#!/usr/bin/swift sh\nimport Foundation\nimport PromiseKit  // @mxcl ~> 6.5 \nimport Swifter     // @mattdonnelly == b27a89\n"
  },
  {
    "path": "Documentation/FAQ.md",
    "chars": 14398,
    "preview": "# FAQ\n\n## Why should I use PromiseKit over X-Promises-Foo?\n\n* PromiseKit has a heavy focus on **developer experience**. "
  },
  {
    "path": "Documentation/GettingStarted.md",
    "chars": 15946,
    "preview": "# `then` and `done`\n\nHere is a typical promise chain:\n\n```swift\nfirstly {\n    login()\n}.then { creds in\n    fetch(avatar"
  },
  {
    "path": "Documentation/Installation.md",
    "chars": 7685,
    "preview": "# Xcode 8.3, 9.x or 10.x / Swift 3 or 4\n\nWe recommend Carthage over CocoaPods, but both installation methods are support"
  },
  {
    "path": "Documentation/ObjectiveC.md",
    "chars": 5568,
    "preview": "# Objective-C\n\nPromiseKit has two promise classes:\n\n* `Promise<T>` (Swift)\n* `AnyPromise` (Objective-C)\n\nEach is designe"
  },
  {
    "path": "Documentation/README.md",
    "chars": 445,
    "preview": "# Contents\n\n* [README](../README.md)\n* Handbook\n  * [Getting Started](GettingStarted.md)\n  * [Promises: Common Patterns]"
  },
  {
    "path": "Documentation/Troubleshooting.md",
    "chars": 8299,
    "preview": "# Troubleshooting\n\n## Compilation errors\n\n99% of compilation issues involving PromiseKit can be addressed or diagnosed b"
  },
  {
    "path": "LICENSE",
    "chars": 1072,
    "preview": "Copyright 2016-present, Max Howell; mxcl@me.com\n\nPermission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "Package.swift",
    "chars": 728,
    "preview": "// swift-tools-version:4.0\n\nimport PackageDescription\n\nlet pkg = Package(name: \"PromiseKit\")\npkg.products = [\n    .libra"
  },
  {
    "path": "Package@swift-4.2.swift",
    "chars": 736,
    "preview": "// swift-tools-version:4.2\n\nimport PackageDescription\n\nlet pkg = Package(name: \"PromiseKit\")\npkg.products = [\n    .libra"
  },
  {
    "path": "Package@swift-5.0.swift",
    "chars": 813,
    "preview": "// swift-tools-version:5.0\n\nimport PackageDescription\n\nlet pkg = Package(name: \"PromiseKit\")\npkg.platforms = [\n   .macOS"
  },
  {
    "path": "Package@swift-5.3.swift",
    "chars": 923,
    "preview": "// swift-tools-version:5.3\n\nimport PackageDescription\n\nlet pkg = Package(name: \"PromiseKit\")\npkg.platforms = [\n   .macOS"
  },
  {
    "path": "PromiseKit.playground/Contents.swift",
    "chars": 580,
    "preview": "import PlaygroundSupport\n\n// Is this erroring? If so open the `.xcodeproj` and build the\n// framework for a macOS target"
  },
  {
    "path": "PromiseKit.playground/contents.xcplayground",
    "chars": 265,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<playground version='3.0' sdk='macosx' auto-termination-delay='2"
  },
  {
    "path": "PromiseKit.playground/playground.xcworkspace/contents.xcworkspacedata",
    "chars": 135,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef"
  },
  {
    "path": "PromiseKit.podspec",
    "chars": 10712,
    "preview": "Pod::Spec.new do |s|\n  s.name = \"PromiseKit\"\n\n  s.version = '8.2.0'\n\n  s.source = {\n    :git => \"https://github.com/mxcl"
  },
  {
    "path": "PromiseKit.xcodeproj/project.pbxproj",
    "chars": 72246,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "PromiseKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 135,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef"
  },
  {
    "path": "PromiseKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "PromiseKit.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "chars": 264,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "PromiseKit.xcodeproj/xcshareddata/xcschemes/PromiseKit.xcscheme",
    "chars": 5816,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1250\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "README.md",
    "chars": 6606,
    "preview": "![PromiseKit](../gh-pages/public/img/logo-tight.png)\n\n[![badge-pod][]][cocoapods] ![badge-languages][] ![badge-pms][] !["
  },
  {
    "path": "Sources/AnyPromise+Private.h",
    "chars": 1021,
    "preview": "@import Foundation.NSError;\n@import Foundation.NSPointerArray;\n\n#if TARGET_OS_IPHONE\n    #define NSPointerArrayMake(N) ("
  },
  {
    "path": "Sources/AnyPromise.h",
    "chars": 11928,
    "preview": "#import <Foundation/Foundation.h>\n#import <dispatch/dispatch.h>\n#import <PromiseKit/fwd.h>\n\n/// INTERNAL DO NOT USE\n@cla"
  },
  {
    "path": "Sources/AnyPromise.m",
    "chars": 4594,
    "preview": "#if __has_include(\"PromiseKit-Swift.h\")\n    #import \"PromiseKit-Swift.h\"\n#else\n    #import <PromiseKit/PromiseKit-Swift."
  },
  {
    "path": "Sources/AnyPromise.swift",
    "chars": 6105,
    "preview": "import Foundation\n\n/**\n __AnyPromise is an implementation detail.\n\n Because of how ObjC/Swift compatibility work we have"
  },
  {
    "path": "Sources/Async.swift",
    "chars": 762,
    "preview": "#if swift(>=5.5)\n#if canImport(_Concurrency)\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npublic extensi"
  },
  {
    "path": "Sources/Box.swift",
    "chars": 2944,
    "preview": "import Dispatch\n\nenum Sealant<R> {\n    case pending(Handlers<R>)\n    case resolved(R)\n}\n\nfinal class Handlers<R> {\n    v"
  },
  {
    "path": "Sources/Catchable.swift",
    "chars": 9712,
    "preview": "import Dispatch\n\n/// Provides `catch` and `recover` to your object that conforms to `Thenable`\npublic protocol CatchMixi"
  },
  {
    "path": "Sources/Combine.swift",
    "chars": 1896,
    "preview": "#if swift(>=4.1)\n#if canImport(Combine)\nimport Combine\n\n@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)\npub"
  },
  {
    "path": "Sources/Configuration.swift",
    "chars": 1498,
    "preview": "import Dispatch\n\n/**\n PromiseKit’s configurable parameters.\n\n Do not change these after any Promise machinery executes a"
  },
  {
    "path": "Sources/CustomStringConvertible.swift",
    "chars": 1374,
    "preview": "\nextension Promise: CustomStringConvertible {\n    /// - Returns: A description of the state of this promise.\n    public "
  },
  {
    "path": "Sources/Deprecations.swift",
    "chars": 3208,
    "preview": "import Dispatch\n\n@available(*, deprecated, message: \"See `init(resolver:)`\")\npublic func wrap<T>(_ body: (@escaping (T?,"
  },
  {
    "path": "Sources/Error.swift",
    "chars": 3480,
    "preview": "import Foundation\n\npublic enum PMKError: Error {\n    /**\n     The completionHandler with form `(T?, Error?)` was called "
  },
  {
    "path": "Sources/Guarantee.swift",
    "chars": 12378,
    "preview": "import class Foundation.Thread\nimport Dispatch\n\n/**\n A `Guarantee` is a functional abstraction around an asynchronous op"
  },
  {
    "path": "Sources/Info.plist",
    "chars": 896,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Sources/LogEvent.swift",
    "chars": 856,
    "preview": "/**\n    The PromiseKit events which may be logged.\n \n    ````\n    /// A promise or guarantee has blocked the main thread"
  },
  {
    "path": "Sources/NSMethodSignatureForBlock.m",
    "chars": 2897,
    "preview": "#import <Foundation/NSMethodSignature.h>\n\nstruct PMKBlockLiteral {\n    void *isa; // initialized to &_NSConcreteStackBlo"
  },
  {
    "path": "Sources/PMKCallVariadicBlock.m",
    "chars": 4042,
    "preview": "#import \"NSMethodSignatureForBlock.m\"\n#import <Foundation/NSDictionary.h>\n#import <Foundation/NSException.h>\n#import \"An"
  },
  {
    "path": "Sources/Promise.swift",
    "chars": 5407,
    "preview": "import class Foundation.Thread\nimport Dispatch\n\n/**\n A `Promise` is a functional abstraction around a failable asynchron"
  },
  {
    "path": "Sources/PromiseKit.h",
    "chars": 239,
    "preview": "#import <PromiseKit/fwd.h>\n#import <PromiseKit/AnyPromise.h>\n\n#import <Foundation/NSObjCRuntime.h>  // `FOUNDATION_EXPOR"
  },
  {
    "path": "Sources/Resolver.swift",
    "chars": 2676,
    "preview": "/// An object for resolving promises\npublic final class Resolver<T> {\n    let box: Box<Result<T>>\n\n    init(_ box: Box<R"
  },
  {
    "path": "Sources/Resources/PrivacyInfo.xcprivacy",
    "chars": 278,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "Sources/Thenable.swift",
    "chars": 19102,
    "preview": "import Dispatch\n\n/// Thenable represents an asynchronous operation that can be chained.\npublic protocol Thenable: AnyObj"
  },
  {
    "path": "Sources/after.m",
    "chars": 526,
    "preview": "#import \"AnyPromise.h\"\n@import Dispatch;\n@import Foundation.NSDate;\n@import Foundation.NSValue;\n\n/// @return A promise t"
  },
  {
    "path": "Sources/after.swift",
    "chars": 1136,
    "preview": "import struct Foundation.TimeInterval\nimport Dispatch\n\n/**\n     after(seconds: 1.5).then {\n         //…\n     }\n\n- Return"
  },
  {
    "path": "Sources/dispatch_promise.m",
    "chars": 315,
    "preview": "#import \"AnyPromise.h\"\n@import Dispatch;\n\nAnyPromise *dispatch_promise_on(dispatch_queue_t queue, id block) {\n    return"
  },
  {
    "path": "Sources/firstly.swift",
    "chars": 907,
    "preview": "import Dispatch\n\n/**\n Judicious use of `firstly` *may* make chains more readable.\n\n Compare:\n\n     URLSession.shared.dat"
  },
  {
    "path": "Sources/fwd.h",
    "chars": 5899,
    "preview": "#import <Foundation/NSDate.h>\n#import <dispatch/dispatch.h>\n\n@class AnyPromise;\nextern NSString * __nonnull const PMKErr"
  },
  {
    "path": "Sources/hang.m",
    "chars": 835,
    "preview": "#import \"AnyPromise.h\"\n#import \"AnyPromise+Private.h\"\n@import CoreFoundation.CFRunLoop;\n\n/**\n Suspends the active thread"
  },
  {
    "path": "Sources/hang.swift",
    "chars": 1762,
    "preview": "import Foundation\nimport CoreFoundation\n\n/**\n Runs the active run-loop until the provided promise resolves.\n\n This is fo"
  },
  {
    "path": "Sources/join.m",
    "chars": 2065,
    "preview": "@import Foundation.NSDictionary;\n#import \"AnyPromise+Private.h\"\n#import <libkern/OSAtomic.h>\n@import Foundation.NSError;"
  },
  {
    "path": "Sources/race.m",
    "chars": 1848,
    "preview": "#import \"AnyPromise+Private.h\"\n#import <libkern/OSAtomic.h>\n\n#pragma clang diagnostic push\n#pragma clang diagnostic igno"
  },
  {
    "path": "Sources/race.swift",
    "chars": 2875,
    "preview": "import Dispatch\n\n@inline(__always)\nprivate func _race<U: Thenable>(_ thenables: [U]) -> Promise<U.T> {\n    let rp = Prom"
  },
  {
    "path": "Sources/when.m",
    "chars": 4592,
    "preview": "@import Foundation.NSDictionary;\n#import \"AnyPromise+Private.h\"\n@import Foundation.NSProgress;\n#import <libkern/OSAtomic"
  },
  {
    "path": "Sources/when.swift",
    "chars": 14986,
    "preview": "import Foundation\nimport Dispatch\n\nprivate func _when<U: Thenable>(_ thenables: [U]) -> Promise<Void> {\n    var countdow"
  },
  {
    "path": "Tests/A+/0.0.0.swift",
    "chars": 5753,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nenum Error: Swift.Error {\n    case dummy  // we reject with this when w"
  },
  {
    "path": "Tests/A+/2.1.2.swift",
    "chars": 927,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test212: XCTestCase {\n    func test() {\n        describe(\"2.1.2.1: When fulfilled"
  },
  {
    "path": "Tests/A+/2.1.3.swift",
    "chars": 1247,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test213: XCTestCase {\n    func test() {\n        describe(\"2.1.3.1: When rejected,"
  },
  {
    "path": "Tests/A+/2.2.2.swift",
    "chars": 3944,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test222: XCTestCase {\n    func test() {\n        describe(\"2.2.2: If `onFulfilled`"
  },
  {
    "path": "Tests/A+/2.2.3.swift",
    "chars": 4046,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test223: XCTestCase {\n    func test() {\n        describe(\"2.2.3: If `onRejected` "
  },
  {
    "path": "Tests/A+/2.2.4.swift",
    "chars": 6308,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test224: XCTestCase {\n    func test() {\n        describe(\"2.2.4: `onFulfilled` or"
  },
  {
    "path": "Tests/A+/2.2.6.swift",
    "chars": 13046,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test226: XCTestCase {\n    func test() {\n        describe(\"2.2.6: `then` may be ca"
  },
  {
    "path": "Tests/A+/2.2.7.swift",
    "chars": 1262,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test227: XCTestCase {\n    func test() {\n        describe(\"2.2.7: `then` must retu"
  },
  {
    "path": "Tests/A+/2.3.1.swift",
    "chars": 1127,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test231: XCTestCase {\n    func test() {\n        describe(\"2.3.1: If `promise` and"
  },
  {
    "path": "Tests/A+/2.3.2.swift",
    "chars": 4566,
    "preview": "import PromiseKit\nimport XCTest\n\nclass Test232: XCTestCase {\n    func test() {\n        describe(\"2.3.2: If `x` is a prom"
  },
  {
    "path": "Tests/A+/2.3.4.swift",
    "chars": 817,
    "preview": "import PromiseKit\nimport XCTest\n\n\nclass Test234: XCTestCase {\n    func test() {\n        describe(\"2.3.4: If `x` is not a"
  },
  {
    "path": "Tests/A+/README.md",
    "chars": 373,
    "preview": "Resources\n=========\n* https://github.com/promises-aplus/promises-tests\n\n\nSkipped\n=======\n* 2.3.3: Otherwise, if x is an "
  },
  {
    "path": "Tests/A+/XCTestManifests.swift",
    "chars": 2777,
    "preview": "#if !canImport(ObjectiveC)\nimport XCTest\n\n#if os(Android)\nextension XCTestExpectation {\n    func fulfill() {\n        ful"
  },
  {
    "path": "Tests/Bridging/BridgingTests.m",
    "chars": 799,
    "preview": "@import PromiseKit;\n@import XCTest;\n#import \"Infrastructure.h\"\n\n\n@interface BridgingTests: XCTestCase @end @implementati"
  },
  {
    "path": "Tests/Bridging/BridgingTests.swift",
    "chars": 7840,
    "preview": "import Foundation\nimport PromiseKit\nimport XCTest\n\nclass BridgingTests: XCTestCase {\n\n    func testCanBridgeAnyObject() "
  },
  {
    "path": "Tests/Bridging/Infrastructure.h",
    "chars": 383,
    "preview": "@import Foundation;\n@class AnyPromise;\n\nAnyPromise *PMKDummyAnyPromise_YES(void);\nAnyPromise *PMKDummyAnyPromise_Manifol"
  },
  {
    "path": "Tests/Bridging/Infrastructure.m",
    "chars": 1037,
    "preview": "@import Foundation;\n@import PromiseKit;\n#import \"Infrastructure.h\"\n\nAnyPromise *PMKDummyAnyPromise_YES(void) {\n    retur"
  },
  {
    "path": "Tests/Bridging/Infrastructure.swift",
    "chars": 521,
    "preview": "import PromiseKit\n\n// for BridgingTests.m\n@objc(PMKPromiseBridgeHelper) class PromiseBridgeHelper: NSObject {\n    @objc "
  },
  {
    "path": "Tests/CoreObjC/AnyPromiseTests.m",
    "chars": 25264,
    "preview": "@import PromiseKit;\n@import XCTest;\n#import \"Infrastructure.h\"\n#define PMKTestErrorDomain @\"PMKTestErrorDomain\"\n\nstatic "
  },
  {
    "path": "Tests/CoreObjC/AnyPromiseTests.swift",
    "chars": 1011,
    "preview": "import PromiseKit\nimport XCTest\n\nclass AnyPromiseTests: XCTestCase {\n    func testFulfilledResult() {\n        switch Any"
  },
  {
    "path": "Tests/CoreObjC/HangTests.m",
    "chars": 278,
    "preview": "@import PromiseKit;\n@import XCTest;\n\n@interface HangTests: XCTestCase @end @implementation HangTests\n\n- (void)test {\n   "
  },
  {
    "path": "Tests/CoreObjC/JoinTests.m",
    "chars": 2710,
    "preview": "@import Foundation;\n@import PromiseKit;\n@import XCTest;\n\n\n@interface JoinTests: XCTestCase @end @implementation JoinTest"
  },
  {
    "path": "Tests/CoreObjC/PMKManifoldTests.m",
    "chars": 2236,
    "preview": "@import PromiseKit;\n@import XCTest;\n\n@interface PMKManifoldTests: XCTestCase @end @implementation PMKManifoldTests\n\n- (v"
  },
  {
    "path": "Tests/CoreObjC/RaceTests.m",
    "chars": 2963,
    "preview": "@import Foundation;\n@import PromiseKit;\n@import XCTest;\n#define PMKTestErrorDomain @\"PMKTestErrorDomain\"\n\nstatic inline "
  },
  {
    "path": "Tests/CoreObjC/WhenTests.m",
    "chars": 7217,
    "preview": "@import Foundation;\n@import PromiseKit;\n@import XCTest;\n\n\n@interface WhenTests: XCTestCase @end @implementation WhenTest"
  },
  {
    "path": "Tests/CorePromise/AfterTests.swift",
    "chars": 1645,
    "preview": "import PromiseKit\nimport XCTest\n\nclass AfterTests: XCTestCase {\n    func testZero() {\n        let ex2 = expectation(desc"
  },
  {
    "path": "Tests/CorePromise/AsyncTests.swift",
    "chars": 3626,
    "preview": "import PromiseKit\nimport XCTest\n\nprivate enum Error: Swift.Error { case dummy }\n\nclass AsyncTests: XCTestCase {\n    \n   "
  },
  {
    "path": "Tests/CorePromise/CancellableErrorTests.swift",
    "chars": 4217,
    "preview": "import Foundation\nimport PromiseKit\nimport XCTest\n\n#if canImport(StoreKit)\nimport StoreKit\n#endif\n\nclass CancellationTes"
  },
  {
    "path": "Tests/CorePromise/CatchableTests.swift",
    "chars": 8472,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nclass CatchableTests: XCTestCase {\n\n    func testFinally() {\n        le"
  },
  {
    "path": "Tests/CorePromise/CombineTests.swift",
    "chars": 6682,
    "preview": "#if swift(>=4.1)\n#if canImport(Combine)\nimport Combine\n#endif\n#endif\nimport PromiseKit\nimport XCTest\n\nprivate enum Error"
  },
  {
    "path": "Tests/CorePromise/DefaultDispatchQueueTests.swift",
    "chars": 1660,
    "preview": "//\n//  PMKDefaultDispatchQueue.test.swift\n//  PromiseKit\n//\n//  Created by David Rodriguez on 4/14/16.\n//  Copyright © 2"
  },
  {
    "path": "Tests/CorePromise/ErrorTests.swift",
    "chars": 1014,
    "preview": "import PromiseKit\nimport XCTest\n\nclass PMKErrorTests: XCTestCase {\n    func testCustomStringConvertible() {\n        XCTA"
  },
  {
    "path": "Tests/CorePromise/GuaranteeTests.swift",
    "chars": 5176,
    "preview": "import PromiseKit\nimport XCTest\n\nclass GuaranteeTests: XCTestCase {\n    func testInit() {\n        let ex = expectation(d"
  },
  {
    "path": "Tests/CorePromise/HangTests.swift",
    "chars": 946,
    "preview": "import PromiseKit\nimport XCTest\n\nclass HangTests: XCTestCase {\n    func test() {\n        let ex = expectation(descriptio"
  },
  {
    "path": "Tests/CorePromise/LoggingTests.swift",
    "chars": 7016,
    "preview": "@testable import PromiseKit\nimport Dispatch\nimport XCTest\n#if canImport(Android)\nimport Android\n#endif\n\nclass LoggingTes"
  },
  {
    "path": "Tests/CorePromise/PromiseTests.swift",
    "chars": 4449,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nclass PromiseTests: XCTestCase {\n    func testIsPending() {\n        XCT"
  },
  {
    "path": "Tests/CorePromise/RaceTests.swift",
    "chars": 3434,
    "preview": "import XCTest\nimport PromiseKit\n\nclass RaceTests: XCTestCase {\n    func test1() {\n        let ex = expectation(descripti"
  },
  {
    "path": "Tests/CorePromise/RegressionTests.swift",
    "chars": 790,
    "preview": "import PromiseKit\nimport XCTest\n\nclass RegressionTests: XCTestCase {\n    func testReturningPreviousPromiseWorks() {\n\n   "
  },
  {
    "path": "Tests/CorePromise/ResolverTests.swift",
    "chars": 6921,
    "preview": "import PromiseKit\nimport XCTest\n\nclass WrapTests: XCTestCase {\n    fileprivate class KittenFetcher {\n        let value: "
  },
  {
    "path": "Tests/CorePromise/StressTests.swift",
    "chars": 2382,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nclass StressTests: XCTestCase {\n    func testThenDataRace() {\n        l"
  },
  {
    "path": "Tests/CorePromise/ThenableTests.swift",
    "chars": 7369,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nstruct Person: Equatable {\n    let name: String\n    let age: Int?\n    l"
  },
  {
    "path": "Tests/CorePromise/Utilities.swift",
    "chars": 729,
    "preview": "import PromiseKit\n\nextension Promise {\n    func silenceWarning() {}\n}\n\n#if os(Linux) || os(Android)\nimport func CoreFoun"
  },
  {
    "path": "Tests/CorePromise/WhenConcurrentTests.swift",
    "chars": 5297,
    "preview": "import XCTest\nimport PromiseKit\n\nclass WhenConcurrentTestCase_Swift: XCTestCase {\n\n    func testWhen() {\n        let e ="
  },
  {
    "path": "Tests/CorePromise/WhenResolvedTests.swift",
    "chars": 1484,
    "preview": "//  Created by Austin Feight on 3/19/16.\n//  Copyright © 2016 Max Howell. All rights reserved.\n\nimport PromiseKit\nimport"
  },
  {
    "path": "Tests/CorePromise/WhenTests.swift",
    "chars": 12797,
    "preview": "import PromiseKit\nimport Dispatch\nimport XCTest\n\nclass WhenTests: XCTestCase {\n\n    func testEmpty() {\n        let e1 = "
  },
  {
    "path": "Tests/CorePromise/XCTestManifests.swift",
    "chars": 15024,
    "preview": "#if !canImport(ObjectiveC)\nimport XCTest\n\nextension AfterTests {\n    // DO NOT MODIFY: This is autogenerated, use:\n    /"
  },
  {
    "path": "Tests/CorePromise/ZalgoTests.swift",
    "chars": 1544,
    "preview": "import XCTest\nimport PromiseKit\n\nclass ZalgoTests: XCTestCase {\n    func test1() {\n        var resolved = false\n        "
  },
  {
    "path": "Tests/DeprecationTests.swift",
    "chars": 3871,
    "preview": "import PromiseKit\nimport XCTest\n\nclass DeprecationTests: XCTestCase {\n    func testWrap1() {\n        let dummy = 10\n\n   "
  },
  {
    "path": "Tests/JS-A+/.gitignore",
    "chars": 985,
    "preview": "# From https://github.com/github/gitignore/blob/master/Node.gitignore\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\n"
  },
  {
    "path": "Tests/JS-A+/AllTests.swift",
    "chars": 3370,
    "preview": "//\n//  AllTests.swift\n//  PMKJSA+Tests\n//\n//  Created by Lois Di Qual on 2/28/18.\n//\n\n#if swift(>=3.2) && !os(watchOS)\n\n"
  },
  {
    "path": "Tests/JS-A+/JSAdapter.swift",
    "chars": 1634,
    "preview": "//\n//  JSAdapter.swift\n//  PMKJSA+Tests\n//\n//  Created by Lois Di Qual on 3/2/18.\n//\n\n#if !os(watchOS)\n\nimport Foundatio"
  },
  {
    "path": "Tests/JS-A+/JSPromise.swift",
    "chars": 3465,
    "preview": "//\n//  JSPromise.swift\n//  PMKJSA+Tests\n//\n//  Created by Lois Di Qual on 3/1/18.\n//\n\n#if !os(watchOS)\n\nimport Foundatio"
  },
  {
    "path": "Tests/JS-A+/JSUtils.swift",
    "chars": 3967,
    "preview": "//\n//  JSUtils.swift\n//  PMKJSA+Tests\n//\n//  Created by Lois Di Qual on 3/2/18.\n//\n\n#if !os(watchOS)\n\nimport Foundation\n"
  },
  {
    "path": "Tests/JS-A+/MockNodeEnvironment.swift",
    "chars": 4751,
    "preview": "//\n//  MockNodeEnvironment.swift\n//  PMKJSA+Tests\n//\n//  Created by Lois Di Qual on 3/1/18.\n//\n\n#if swift(>=3.2) && !os("
  },
  {
    "path": "Tests/JS-A+/README.md",
    "chars": 3040,
    "preview": "Promises/A+ Compliance Test Suite (JavaScript)\n==============================================\n\nWhat is this?\n-----------"
  },
  {
    "path": "Tests/JS-A+/index.js",
    "chars": 1050,
    "preview": "const _ = require('lodash')\nrequire('mocha')\n\n// Ignored by design\nconst ignoredTests = [\n  '2.3.3'\n]\n\nmodule.exports = "
  },
  {
    "path": "Tests/JS-A+/package.json",
    "chars": 386,
    "preview": "{\n  \"scripts\": {\n    \"build\": \"webpack-cli\",\n    \"watch\": \"webpack-cli --watch --mode development\"\n  },\n  \"dependencies\""
  },
  {
    "path": "Tests/JS-A+/webpack.config.js",
    "chars": 522,
    "preview": "var webpack = require('webpack');\n\nmodule.exports = {\n  mode: 'development',\n  context: __dirname,\n  entry: './index.js'"
  },
  {
    "path": "Tests/LinuxMain.swift",
    "chars": 158,
    "preview": "import XCTest\n\nimport APlus\nimport CorePromise\n\nvar tests = [XCTestCaseEntry]()\ntests += APlus.__allTests()\ntests += Cor"
  },
  {
    "path": "tea.yaml",
    "chars": 188,
    "preview": "# https://tea.xyz/what-is-this-file\n# created with https://mash.pkgx.sh/mxcl/tea-register\n---\nversion: 1.0.0\ncodeOwners:"
  }
]

About this extraction

This page contains the full source code of the mxcl/PromiseKit GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 135 files (544.2 KB), approximately 143.5k tokens, and a symbol index with 1 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!