【发布时间】:2018-09-04 08:33:42
【问题描述】:
我将 Observable 设为 Bool 类型,如下所示
let allValid: Observable<Bool>
//All valid is combination of two more Observable<Bool>
allValid = Observable.combineLatest(checkBoxValid, reasonValid) { $0 && $1 }
现在我想检查何时按下完成按钮,根据 AllValid 的值调用相应的方法。
public func doneButtonPressed() {
//Here I have two methods, and to be called, when AllValid is true and false
//self.method1()
//self.method2()
}
现在如何制作。我不能直接绑定,因为它会触发,我想在按下 Done 时触发。
【问题讨论】:
-
doneButtonPressed应该由按钮事件触发。
标签: swift observable rx-swift