Merge pull request #423 from koke/feature/playground-generate

Add generate example to playground
This commit is contained in:
Krunoslav Zaher 2016-01-22 22:32:23 +01:00
commit 365550e3ec
1 changed files with 19 additions and 0 deletions

View File

@ -111,6 +111,25 @@ example("create") {
}
}
/*:
### generate
`generate` creates sequence that generates its values and determines when to terminate based on its previous values.
*/
example("generate") {
let generated = Observable.generate(
initialState: 0,
condition: { $0 < 3 },
iterate: { $0 + 1 }
)
let subscription = generated
.subscribe { event in
print(event)
}
}
/*:
### failWith
create an Observable that emits no items and terminates with an error