You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Promise object is used for deferred and asynchronous computations. A Promise represents an operation that hasn't completed yet, but is expected in the future.
Ref
In JavaScript, Promise handles asynchronising call beatifully:
Using RWPromise is exactly same as using promise in js. resolve and reject are provided in initial block as input parameters, these two methods are used to change the state of a promise. Block passed in then will be invoked when a promise is set to resolved while one in catch will be invoked when rejected.
For more infomation about the API of promise in js, please reference here
Suppoted API
0.1.0
then
catch
finally
after
retry
timeout
map
filter
reduce
race
all
resolve
reject
0.2.0
progress
Installation
Cocoapods
pod 'RWPromiseKit', '0.2.0'
Source code
Copy all source files from directory Class to your project
Issues and Todo list
I simplify the usage of then compared with js. Just pass only one handler block to handle when last promise is resolved. To reject, you can raise an expection or return a new promise.