NGRValidator
NGRValidator is a powerful and flexible form validation library for iOS development. With easy integration and comprehensive validation options, it helps you ensure the accuracy and integrity of user-submitted data.
Key Features
- Simple integration for iOS projects
- Extensive set of validation rules
- Customizable error messages
- Support for nested and complex form structures
- Real-time and on-demand validation
- Effortless error presentation
- Flexible callbacks and delegate methods
- Compatible with Swift and Objective-C
Installation
To integrate NGRValidator into your iOS project, follow these steps:
- Ensure you have CocoaPods installed and initialized in your project directory.
- Add the NGRValidator pod to your
Podfile
: - Run
pod install
in your terminal to install the NGRValidator dependency. - Open your project’s workspace using the
.xcworkspace
file. - Import the NGRValidator module in the necessary classes:
# CocoaPods
pod 'NGRValidator'
// Swift
import NGRValidator
// Objective-C
#import <NGRValidator/NGRValidator.h>
Usage
NGRValidator provides a straightforward API to quickly validate your forms. Follow the steps below to start using it in your project:
- Create an instance of NGRValidator:
- Add validation rules for your form fields:
- Validate your form:
NGRValidator *validator = [[NGRValidator alloc] init];
[validator registerField:textField name:@"email" rules:@[[NGRRequiredRule new], [NGREmailRule new]]];
NGRValidationResult *result = [validator validateFields];
if (!result.isValid) {
// Handle validation errors
for (NGRValidationRuleResult *ruleResult in result.results) {
if (!ruleResult.isValid) {
NSString *fieldName = ruleResult.field.name;
NSArray *errors = ruleResult.errors;
// Display error messages to the user
}
}
}
Advanced Usage
NGRValidator offers more advanced features to handle complex form structures, such as nested fields and custom rule sets. Refer to the documentation for detailed usage instructions and code examples.
Additional Resources
With NGRValidator, validating forms in your iOS applications has never been easier. Save time and effort by seamlessly integrating this powerful library into your project.