PromiseKit/PromiseKit.playground/Contents.swift
Carlos Cuba eed0ef15ab PromiseKit.playground/section-1.swift renamed to Contents.swift to fix Xcode error - Playground file is missing a "Contents.swift" file.
This being made, building the framework for a macOS target, as described on the file's initial comments, makes us able to run the Playground without any issues.
Xcode Version 9.0 (9A235)
2017-10-08 13:04:13 -05:00

30 lines
582 B
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).then {
return 3
}
}
firstly {
Promise(value: 1)
}.then { _ in
2
}.then { _ in
promise3()
}.then {
print($0) // => 3
}.always {
// always happens
}.catch { error in
// only happens for errors
}
PlaygroundPage.current.needsIndefiniteExecution = true