SHARE
TWEET

Untitled

a guest Oct 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let behaviorRelay = BehaviorRelay(value: "Initial value")
  2.     let disposeBag = DisposeBag()
  3.    
  4.     behaviorRelay.subscribe{
  5.         print(label: "1)", event: $0)
  6.     }
  7.     .disposed(by: disposeBag)
  8.    
  9.     behaviorRelay.accept("no way")
  10.    
  11.     behaviorRelay.subscribe{
  12.         print(label: "2)", event: $0)
  13.     }
  14.     .disposed(by: disposeBag)
  15.    
  16.     print(behaviorRelay.value)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top