Swift/RxSwift
-
RxSwift Merge 이용해서 Event 묶기Swift/RxSwift 2022. 7. 20. 11:21
Observable.merge(self.node.passwordText.rx.controlEvent(.editingDidEndOnExit).asObservable(), self.node.loginButton.rx.tap.asObservable()) .map { Reactor.Action.login } .bind(to: reactor.action) .disposed(by: self.disposeBag) Observable.merge() 는 parameter 로 Observable 을 받음. .rx.controlEvent() 는 ControlEvent 를 return 하므로, ControlEvent -> Observable 로 바꾸어줘야함. ( .asObservable )
-
ObservablesSwift/RxSwift 2022. 3. 25. 18:12
Observable == Observable sequence == Sequence An Observable is just a sequence, with some special powers. - Asynchronous. Observables produce events over a period of time, which is referred to as emitting. Events can contain values, such as numbers or instances of a custom type, or they can be recognized by gestures, such as taps. When an observable emits an element, it does so in what’s known a..
-
SubjectsSwift/RxSwift 2022. 3. 25. 00:44
import UIKit import RxSwift func example(of description: String, action: () -> Void) { print("\n--- Example of:", description, "---") action() } Observables are a fundamental part of RxSwift, but they’re essentially read-only. You may only subscribe to them to get notified of new events they produce. A common need when developing apps is to manually add new values onto an observable during runti..