Try to use ReativeSwift on my project, but something not perform well I have check many times, cant find out what's wrong. Everything is right, and it just not called.
class MSCreateScheduleViewModel: NSObject {
var scheduleModel = MSScheduleModel()
var validateAction: Action<(), Bool, NoError>!
override init() {
super.init()
validateAction = Action(execute: { (_) -> SignalProducer<Bool, NoError> in
return self.valiateScheduleModel()
})
validateAction.values.observeValues { (isok) in
print("isok??") //this line not called
}
validateAction.values.observeCompleted {
print("completed") //this line not called
}
}
func valiateScheduleModel() -> SignalProducer<Bool, NoError> {
let (signal, observer) = Signal<Bool, NoError>.pipe()
let signalProducer = SignalProducer<Bool, NoError>(_ :signal)
observer.send(value: true) //this line called
observer.sendCompleted() //this line called
return signalProducer
}
}