Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convenience methods to Obj-C for then+catch #45

Closed
lilyball opened this issue Oct 22, 2019 · 0 comments
Closed

Add convenience methods to Obj-C for then+catch #45

lilyball opened this issue Oct 22, 2019 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@lilyball
Copy link
Owner

The Obj-C API is a little awkward with the nested method calls thanks to Obj-C messaging style. We might want to consider adding the following methods for convenience:

- (TWLPromise *)then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler;

- (TWLPromise *)onContext:(TWLContext *)context then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler;
- (TWLPromise *)onContext:(TWLContext *)context token:(nullable TWLInvalidationToken *)token then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler;

- (TWLPromise *)then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler whenCancelled:(void (^)(void))cancelHandler;
- (TWLPromise *)onContext:(TWLContext *)context then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler whenCancelled:(void (^)(void))cancelHandler;
- (TWLPromise *)onContext:(TWLContext *)context token:(nullable TWLInvalidationToken *)token then:(void (^)(ValueType value))thenHandler catch:(void (^)(ErrorType error))catchHandler whenCancelled:(void (^)(void))cancelHandler;
@lilyball lilyball added enhancement New feature or request good first issue Good for newcomers labels Oct 22, 2019
@lilyball lilyball added this to the Next milestone May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant