{"id":13685299,"url":"https://github.com/ustwo/US2FormValidator","last_synced_at":"2025-05-01T04:30:32.413Z","repository":{"id":2196092,"uuid":"3144326","full_name":"ustwo/US2FormValidator","owner":"ustwo","description":"Form validation framework for iOS.","archived":false,"fork":false,"pushed_at":"2020-02-29T08:47:30.000Z","size":3400,"stargazers_count":590,"open_issues_count":8,"forks_count":76,"subscribers_count":108,"default_branch":"master","last_synced_at":"2025-04-04T15:10:01.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ustwo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-10T10:12:40.000Z","updated_at":"2024-12-31T15:31:35.000Z","dependencies_parsed_at":"2022-08-30T09:20:34.786Z","dependency_job_id":null,"html_url":"https://github.com/ustwo/US2FormValidator","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ustwo%2FUS2FormValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ustwo%2FUS2FormValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ustwo%2FUS2FormValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ustwo%2FUS2FormValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ustwo","download_url":"https://codeload.github.com/ustwo/US2FormValidator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251824030,"owners_count":21649788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T14:00:48.440Z","updated_at":"2025-05-01T04:30:32.084Z","avatar_url":"https://github.com/ustwo.png","language":"Objective-C","readme":"![Import framework screen](https://github.com/ustwo/US2FormValidator/raw/master/Documentation/Images/Form Validator Sample Preview.png)\n\nustwo™ iOS Form Validator\n=========================\n\n[![Build Status](https://travis-ci.org/ustwo/US2FormValidator.png?branch=master)](https://travis-ci.org/ustwo/US2FormValidator)\n\nThis framework allows you to validate inputs of text fields and text views in a convenient way.\n\nFeatures\n--------\n\n* Simply use US2ValidatorTextField instead of UITextField (US2ValidatorTextView instead of UITextView)\n* Know what went wrong and where\n* Create own conditions using regular expressions for example\n* Create own validators which contain a collection of conditions\n\nInstallation\n------------\n\n### Clone the project\n\nClone the project from the link above.\n\n### Import the framework project into your project\n\n![Import framework screen](https://github.com/ustwo/US2FormValidator/raw/master/Documentation/Images/Import Framework.png)\n\n### Set target dependencies\n\n![Target dependencies screen](https://github.com/ustwo/US2FormValidator/raw/master/Documentation/Images/Target Dependencies.png)\n\n### Add US2Localizable.strings to your projects Copy Bundle Resources\n\n![Target dependencies screen](https://github.com/ustwo/US2FormValidator/raw/master/Documentation/Images/Bundle Resources.png)\n\nInstallation using CocoaPods\n----------------------------\n\nHow to use CocoaPods? Go to:\nhttps://github.com/CocoaPods/CocoaPods\n\nAdd the following line to your pod file:\n\n    pod 'US2FormValidator', '~\u003e 1.1.2'\n\nHow-To\n------\n\n### Add a condition to validator\n\n    US2Validator *validator = [[US2Validator alloc] init];\n    \n    US2ConditionAlphabetic *condition = [[US2ConditionAlphabetic alloc] init];\n    [validator addCondition:condition];\n    [condition release];\n    \n    US2ConditionCollection *conditionCollection1 = [validator checkConditions:@\"HelloWorld\"];\n    US2ConditionCollection *conditionCollection2 = [validator checkConditions:@\"Hello World 123\"];\n    \n    BOOL isValid = conditionCollection1 == nil;                                                  // isValid == YES\n    isValid = conditionCollection2 == nil;                                                       // isValid == NO\n    \n    // What went wrong?\n    NSLog(@\"conditionCollection2: %@\", conditionCollection2);\n\n### Add a validation text field\n\n    US2ValidatorTextField *firstNameTextField  = [[US2ValidatorTextField alloc] init];\n    firstNameTextField.validator               = [[[MyProjectValidatorName alloc] init] autorelease];\n    firstNameTextField.shouldAllowViolation    = YES;\n    firstNameTextField.validateOnFocusLossOnly = YES;\n    firstNameTextField.placeholder             = @\"Enter first name\";\n    firstNameTextField.validatorUIDelegate     = self;\n    [_textUICollection addObject:firstNameTextField];\n    [firstNameTextField release];\n\n### Create own condition\n\nCreate the interface.\n\n\t#import \u003cFoundation/Foundation.h\u003e\n\t#import \"US2Condition.h\"\n\t\n\t\n\t@interface MyProjectConditionName : US2Condition\n\t\n\t@end\n\nCreate the implementation.\n\n\t#import \"MyProjectConditionName.h\"\n\t\n\t\n\t@implementation MyProjectConditionName\n\n\t- (BOOL)check:(NSString *)string\n\t{\n\t\tif (nil == string)\n\t\t\tstring = [NSString string];\n\t\t\n\t\tself.regexString = @\"[a-zA-Z .-]\";\n\t\t\n\t\treturn [super check:string];\n\t}\n\t\n\t\n\t#pragma mark - Allow violation\n\t\n\t- (BOOL)shouldAllowViolation\n\t{\n\t\treturn YES;\n\t}\n\t\n\t\n\t#pragma mark - Localization\n\t\n\t- (NSString *)localizedViolationString\n\t{\n\t\treturn @\"Not a valid name\";\n\t}\n\t\n\t\n\t@end\n\n### Create own validator\n\nCreate the interface.\n\n\t#import \u003cFoundation/Foundation.h\u003e\n\t#import \"US2Validator.h\"\n\t\n\t\n\t#pragma mark - Validator interface\n\t\n\t@interface MyProjectValidatorName : US2Validator\n\t{\n\t}\n\t\n\t\n\t@end\n\nCreate the implementation.\n\n\t#import \"MyProjectValidatorName.h\"\n\t#import \"MyProjectConditionName.h\"\n\t#import \"US2ConditionRange.h\"\n\t\n\t\n\t@implementation MyProjectValidatorName\n\t\n\t\n\t#pragma mark - Initialization\n\t\n\t- (id)init\n\t{\n\t\tself = [super init];\n\t\tif (self)\n\t\t{\n\t\t\t[self addCondition:[[[MyProjectConditionName alloc] init] autorelease]];\n\t\t\t\n\t\t\tUS2ConditionRange *rangeCondition   = [[[US2ConditionRange alloc] init] autorelease];\n\t\t\trangeCondition.range                = NSMakeRange(2, UINT16_MAX);\n\t\t\trangeCondition.shouldAllowViolation = YES;\n\t\t\t\n\t\t\t[self addCondition:rangeCondition];\n\t\t}\n\t\t\n\t\treturn self;\n\t}\n\t\n\t\n\t@end\n\t\n[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/5c7741973650e3249271c084dcfd36e2 \"githalytics.com\")](http://githalytics.com/ustwo/US2FormValidator)","funding_links":[],"categories":["Objective-C","etc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fustwo%2FUS2FormValidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fustwo%2FUS2FormValidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fustwo%2FUS2FormValidator/lists"}