Hello! I think this is noob question. I am straining to using PromiseKit. So my question is how I can return empty Promise
EventsWorker.getAllEvents().then { events in
self.events = events
}.then {
fulfill()
}.catch { error in
reject(error)
}
I want this to modify as:
EventsWorker.getAllEvents().then { events in
self.events = events
fulfill()
// I must return Promise<T> here, right?
}.catch { error in
reject(error)
}
Thank you in advance!
// I must return Promise
here, right?
No, you can return Void. I presume you are getting an error, although you didn't say. If so specify the return type:
EventsWorker.getAllEvents().then { events -> Void in
Thank you @mxcl , that's what I need!
Yes, my error was "Missing return in a closure expected to return 'Promise<()>'"
np, this is an unfortunately common problem, and there's nothing we can do, it's up to the Swift team to fix it.
Most helpful comment
No, you can return
Void. I presume you are getting an error, although you didn't say. If so specify the return type: