Promise/A+, Bluebird inspired, implementation in Swift 5
Promise.value()
.publisher()
methodPromise
is backed by os_unfair_lock
bringing a significant performance improvement. On prior versions of iOS and macOS the locking mechanism falls back to a serial DispatchQueue
Lock
class that hides the implementation detail of the underlying lock, preferring os_unfair_lock
when available, and falling back to a serial DispatchQueue
when it's not.Promise.cancel
Promise { resolve, reject, onCancel in }
Promise.tapCatch
Promise.return
catchThen
to recover