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
RAC(self, titleLabel.text) = RACObserve(self, title); |
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
class ProfileManager { | |
static let shared = ProfileManager() | |
let usernameObservable: Observable<String> | |
private let usernameSubject: BehaviorSubject<String> | |
private var username: String { | |
didSet { | |
usernameSubject.onNext(username) | |
} |
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 disposeBag = DisposeBag() | |
let publishSubject = PublishSubject<String>() | |
//subscribe for changes | |
publishSubject | |
.subscribe(onNext: { title in | |
titleLabel.text = title | |
}) | |
.disposed(by: disposeBag) |
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
var title: String { | |
didSet { | |
titleLabel.text = title | |
} | |
} |
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
var title: String | |
var titleLabel: UILabel |
NewerOlder