I use RxSwift at work (ont a big fan, too complex, but really powerful indeed), and I want to try to use PromiseKit as a "smaller" tool.
I try to create sort of an Observable with PromiseKit, but I can't figure it out. I tried to use the NSObject's extension observe(key path: String) -> Promise, but it does not seems to work.
I noted that I have a struct (hence does not inherit from NSObject) and I tried to observe an NSObject, but it does not seems to work.
Here's what I've done :
in my controller that has the value I want to observe, I declared a variable as follows :
lazy var homeworkPromise: Promise<Homework> = self.observe(keyPath: "homework")
Somewhere in my code, I update the value of the homework variable.
And in my presentingVC, here's what I do :
create.homeworkPromise
.then(execute: { h -> Void in
print(h)
})
It seems pretty straightforward to me, but I guess I'm missing something ;-) Thanks for your help.