Advertisement
rehannali

Bindable Class for Swift i.e. RxSwift

Apr 18th, 2019
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.24 KB | None | 0 0
  1. class Bindable<T> {
  2.     var value: T? {
  3.         didSet {
  4.             observer?(value)
  5.         }
  6.     }
  7.    
  8.     var observer: ((T?) -> ())?
  9.    
  10.     func bind(observer: @escaping (T?) -> ()) {
  11.         self.observer = observer
  12.     }
  13.    
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement