Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document how to get the playground to work
Refs #644
- Loading branch information
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
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(interval: 1).then { | ||
return 3 | ||
} | ||
} | ||
|
||
firstly { | ||
Promise(value: 1) | ||
}.then { _ in | ||
2 | ||
}.then { _ in | ||
3 | ||
promise3() | ||
}.then { | ||
print($0) // => 3 | ||
}.always { | ||
// always happens | ||
}.catch { error in | ||
// never happens! | ||
// only happens for errors | ||
} | ||
|
||
PlaygroundPage.current.needsIndefiniteExecution = true |