Created
June 28, 2019 05:10
-
-
Save eunjin3786/f369db0a510af19e4f36bb595b25b31a to your computer and use it in GitHub Desktop.
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 subject = BehaviorSubject<String>.init(value: "Init Value") | |
subject.onNext("Is anyone listening?") | |
let subcription1 = subject.subscribe { event in | |
print("1) \(event)") | |
} | |
let subcription2 = subject.subscribe { event in | |
print("2) \(event)") | |
} | |
subject.onNext("Hello") | |
subject.onCompleted() | |
subject.onNext("Is alive?") | |
<Output> | |
1) next(Is anyone listening?) | |
2) next(Is anyone listening?) | |
1) next(Hello) | |
2) next(Hello) | |
1) completed | |
2) completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment