Created
July 4, 2017 04:09
-
-
Save ukitaka/f3a7e119c31c901b64a4f7de213814f2 to your computer and use it in GitHub Desktop.
asDriver
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
let o = Observable.of(1,2,3) | |
.map { n -> Int in | |
print("map1 - \(n)") | |
return n | |
} | |
.asDriver(onErrorJustReturn: 0) | |
.map { n -> Int in | |
print("map2 - \(n)") | |
return n | |
} | |
o.drive() | |
o.drive() |
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
map1 - 1 | |
map2 - 1 | |
map1 - 2 | |
map2 - 2 | |
map1 - 3 | |
map2 - 3 | |
map1 - 1 | |
map2 - 1 | |
map1 - 2 | |
map2 - 2 | |
map1 - 3 | |
map2 - 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment