Skip to content

Commit

Permalink
Document how to get the playground to work
Browse files Browse the repository at this point in the history
Refs #644
  • Loading branch information
mxcl committed Apr 29, 2017
1 parent cfae62d commit 88b5ec2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion PromiseKit.playground/contents.xcplayground
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='3.0' sdk='iphonesimulator' auto-termination-delay='2'>
<playground version='3.0' sdk='macosx' auto-termination-delay='2'>
<sections>
<code source-file-name='section-1.swift'/>
</sections>
Expand Down
19 changes: 17 additions & 2 deletions PromiseKit.playground/section-1.swift
@@ -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

0 comments on commit 88b5ec2

Please sign in to comment.