XLForm icon indicating copy to clipboard operation
XLForm copied to clipboard

asynchronous validation?

Open bhirt-bpl opened this issue 12 years ago • 1 comments

Is it possible to think about ways to support async validation? There are many times when validation of data requires some kind of async operation.

I haven't looked at the code too much, but it seems like it would only take extending a few methods to have a completion block that fires when validation is done.

For example:

- (void) formValidationErrorsWithCompletion:(void (^)(NSArray *errors))completion;
- (void) localValidationErrorsForViewController:(XLFormViewController *)formViewController completion:(void (^)(NSArray *errors))completion;
- (void) doValidationWithCompletion: (void (^)(XLFormValidationStatus *status))completion;

You could even implement a synchronous version of doValidation that keeps the existing API working. The caveat would be you don't want to use the sync version if you are doing async validation since you would end up blocking the main thread until all the validation is completed. However, for simple things that don't require more complex async validation it would provide people with that simple interface.

bhirt-bpl avatar Jul 31 '14 18:07 bhirt-bpl

@bhirt-bpl I would prefer to stay away of the async validation code. Mainly because is not the main focus of the library and the custom code to do so should be easy to implement. It will not reduce the time spending on form or settings creation.

Regards

mtnbarreto avatar Feb 03 '15 19:02 mtnbarreto