├── .github └── FUNDING.yml ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── Examples ├── Objective-C │ ├── Examples │ │ ├── AccessoryViews │ │ │ ├── AccessoryViewFormViewController.h │ │ │ └── AccessoryViewFormViewController.m │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── CustomRows │ │ │ ├── CustomRowsViewController.h │ │ │ ├── CustomRowsViewController.m │ │ │ ├── FloatLabeledTextField │ │ │ │ ├── FloatLabeledTextFieldCell.h │ │ │ │ └── FloatLabeledTextFieldCell.m │ │ │ ├── Rating │ │ │ │ ├── RatingView │ │ │ │ │ ├── XLRatingView.h │ │ │ │ │ └── XLRatingView.m │ │ │ │ ├── XLFormRatingCell.h │ │ │ │ ├── XLFormRatingCell.m │ │ │ │ └── XLFormRatingCell.xib │ │ │ └── Weekdays │ │ │ │ ├── XLFormWeekDaysCell.h │ │ │ │ ├── XLFormWeekDaysCell.m │ │ │ │ └── XLFormWeekDaysCell.xib │ │ ├── Dates │ │ │ ├── DateAndTimeValueTrasformer.h │ │ │ ├── DateAndTimeValueTrasformer.m │ │ │ ├── DatesFormViewController.h │ │ │ ├── DatesFormViewController.m │ │ │ └── XLForm-Dates.gif │ │ ├── ExamplesFormViewController.h │ │ ├── ExamplesFormViewController.m │ │ ├── Formatters │ │ │ ├── FormattersViewController.h │ │ │ └── FormattersViewController.m │ │ ├── Inputs │ │ │ ├── InputsFormViewController.h │ │ │ ├── InputsFormViewController.m │ │ │ └── XLForm-Inputs.gif │ │ ├── MultiValuedSections │ │ │ ├── MultivaluedFormViewController.h │ │ │ ├── MultivaluedFormViewController.m │ │ │ └── XLForm-MultiValuedSections.gif │ │ ├── Others │ │ │ ├── CustomCells │ │ │ │ ├── XLFormCustomCell.h │ │ │ │ ├── XLFormCustomCell.m │ │ │ │ ├── XLFormImageSelectorCell.h │ │ │ │ └── XLFormImageSelectorCell.m │ │ │ ├── OthersFormViewController.h │ │ │ ├── OthersFormViewController.m │ │ │ ├── XLForm-Boolean.gif │ │ │ └── XLForm-stepCounter.gif │ │ ├── PredicateExamples │ │ │ ├── BasicPredicateViewController.h │ │ │ ├── BasicPredicateViewController.m │ │ │ ├── BlogExampleViewController.h │ │ │ ├── BlogExampleViewController.m │ │ │ ├── PredicateFormViewController.h │ │ │ ├── PredicateFormViewController.m │ │ │ ├── XLFormPredicates.gif │ │ │ └── XLFormPredicatesBasic.gif │ │ ├── RealExamples │ │ │ ├── NativeEventFormViewController.h │ │ │ ├── NativeEventFormViewController.m │ │ │ └── XLForm.gif │ │ ├── Selectors │ │ │ ├── CustomSelectors │ │ │ │ ├── CustomSelectorsFormViewController.h │ │ │ │ ├── CustomSelectorsFormViewController.m │ │ │ │ └── XLFormRowViewController │ │ │ │ │ ├── CLLocationValueTrasformer.h │ │ │ │ │ ├── CLLocationValueTrasformer.m │ │ │ │ │ ├── MapViewController.h │ │ │ │ │ ├── MapViewController.m │ │ │ │ │ ├── MapViewController.xib │ │ │ │ │ └── XLForm-map-custom-selector.gif │ │ │ ├── DynamicSelector │ │ │ │ ├── DynamicSelectorsFormViewController.h │ │ │ │ ├── DynamicSelectorsFormViewController.m │ │ │ │ ├── UsersTableViewController.h │ │ │ │ ├── UsersTableViewController.m │ │ │ │ └── XLForm-dynamic-custom-selector.gif │ │ │ ├── HTTPSessionManager.h │ │ │ ├── HTTPSessionManager.m │ │ │ ├── Helpers │ │ │ │ └── Data │ │ │ │ │ └── Model.xcdatamodeld │ │ │ │ │ └── Model.xcdatamodel │ │ │ │ │ └── contents │ │ │ ├── SelectorsFormViewController.h │ │ │ ├── SelectorsFormViewController.m │ │ │ └── XLForm-Selectors.gif │ │ ├── StoryboardExample │ │ │ └── iPhoneStoryboard.storyboard │ │ ├── UICustomization │ │ │ ├── UICustomizationFormViewController.h │ │ │ └── UICustomizationFormViewController.m │ │ └── Validations │ │ │ ├── ValidationExamplesFormViewController.h │ │ │ └── ValidationExamplesFormViewController.m │ ├── Inline Segmented │ │ ├── XLFormInlineSegmentedCell.h │ │ └── XLFormInlineSegmentedCell.m │ ├── Podfile │ ├── Podfile.lock │ ├── XLForm.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── XLForm.xcworkspace │ │ └── contents.xcworkspacedata │ └── XLForm │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── xl_appicon_114.png │ │ │ ├── xl_appicon_120.png │ │ │ ├── xl_appicon_152.png │ │ │ ├── xl_appicon_57.png │ │ │ └── xl_appicon_76.png │ │ ├── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ └── xl_splash@2x.png │ │ ├── Star.imageset │ │ │ ├── Contents.json │ │ │ └── Star.png │ │ ├── checkedDay.imageset │ │ │ ├── Contents.json │ │ │ └── vweekday.png │ │ ├── default_avatar.imageset │ │ │ ├── Contents.json │ │ │ └── default-avatar@2x.png │ │ └── uncheckedDay.imageset │ │ │ ├── Contents.json │ │ │ └── xweekday.png │ │ ├── XLForm-Info.plist │ │ ├── XLForm-Prefix.pch │ │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── Localizable.strings │ │ └── main.m └── Swift │ ├── Podfile │ ├── SwiftExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── SwiftExample.xcworkspace │ └── contents.xcworkspacedata │ └── SwiftExample │ ├── AccessoryViews │ └── AccessoryViewFormViewController.swift │ ├── AppDelegate.swift │ ├── CustomRows │ ├── CustomRowsViewController.swift │ ├── FloatLabeledTextField │ │ └── FloatLabeledTextFieldCell.swift │ ├── InlineSegmentedCell │ │ └── InlineSegmentedCell.swift │ ├── Rating │ │ ├── RatingView │ │ │ └── XLRatingView.swift │ │ ├── XLFormRatingCell.swift │ │ └── XLFormRatingCell.xib │ └── Weekdays │ │ ├── XLFormWeekDaysCell.swift │ │ └── XLFormWeekDaysCell.xib │ ├── CustomSelectors │ ├── CustomSelectorsFormViewController.swift │ └── XLFormRowViewController │ │ ├── CLLocationValueTrasformer.swift │ │ ├── MapViewController.swift │ │ └── MapViewController.xib │ ├── Dates │ ├── DateAndTimeValueTrasformer.swift │ └── DatesFormViewController.swift │ ├── DynamicSelector │ ├── DynamicSelectorsFormViewController.swift │ └── UsersTableViewController.swift │ ├── ExamplesFormViewController.swift │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── xl_appicon_120-1.png │ │ ├── xl_appicon_120.png │ │ ├── xl_appicon_152.png │ │ ├── xl_appicon_58.png │ │ ├── xl_appicon_76.png │ │ ├── xl_appicon_80.png │ │ └── xl_appicon_87.png │ ├── LaunchImage.launchimage │ │ ├── Contents.json │ │ └── xl_splash@2x.png │ ├── Simpsons │ │ ├── Apu_Nahasapeemapetilon.imageset │ │ │ ├── Apu_Nahasapeemapetilon.png │ │ │ └── Contents.json │ │ ├── Bart_Simpsons.imageset │ │ │ ├── Bart_Simpsons.png │ │ │ └── Contents.json │ │ ├── Homer_Simpsons.imageset │ │ │ ├── Contents.json │ │ │ └── Homer_Simpsons.png │ │ ├── Lisa_Simpsons.imageset │ │ │ ├── Contents.json │ │ │ └── Lisa_Simpsons.png │ │ ├── Maggie_Simpsons.imageset │ │ │ ├── Contents.json │ │ │ └── Maggie_Simpsons.png │ │ ├── Marge_Simpsons.imageset │ │ │ ├── Contents.json │ │ │ └── Marge_Simpsons.png │ │ ├── Montgomery_Burns.imageset │ │ │ ├── Contents.json │ │ │ └── Montgomery_Burns.png │ │ ├── Ned_Flanders.imageset │ │ │ ├── Contents.json │ │ │ └── Ned_Flanders.png │ │ ├── Otto_Mann.imageset │ │ │ ├── Contents.json │ │ │ └── Otto_Mann.png │ │ └── default-avatar.imageset │ │ │ ├── Contents.json │ │ │ └── default-avatar@2x.png │ ├── checkedDay.imageset │ │ ├── Contents.json │ │ └── vweekday.png │ ├── default_avatar.imageset │ │ ├── Contents.json │ │ └── default-avatar@2x.png │ └── uncheckedDay.imageset │ │ ├── Contents.json │ │ └── xweekday.png │ ├── Info.plist │ ├── Inputs │ └── InputsFormViewController.swift │ ├── MultiValuedSections │ └── MultivaluedFormViewController.swift │ ├── Others │ ├── CustomCells │ │ └── XLFormCustomCell.swift │ └── OthersFormViewController.swift │ ├── PredicateExamples │ ├── BasicPredicateViewController.swift │ ├── BlogExampleViewController.swift │ └── PredicateFormViewController.swift │ ├── RealExamples │ └── NativeEventFormViewController.swift │ ├── SelectorsFormViewController.swift │ ├── StoryboardExample │ └── iPhoneStoryboard.storyboard │ ├── SwiftExample-Bridging-Header.h │ ├── UICustomization │ └── UICustomizationFormViewController.swift │ └── Validations │ └── ValidationExamplesFormViewController.swift ├── LICENSE ├── Package.swift ├── README.md ├── Rakefile ├── Tests ├── Podfile ├── XLForm Tests.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── XLForm Tests.xcscheme ├── XLForm Tests.xcworkspace │ └── contents.xcworkspacedata └── XLForm Tests │ ├── Helpers │ ├── UITextField+Test.h │ └── UITextField+Test.m │ ├── Test │ ├── XLFormExampleTest.m │ ├── XLFormValidatorsTests.m │ ├── XLTestCase.h │ ├── XLTestCase.m │ ├── XLTestHideAndShow.m │ ├── XLTestTextFieldProperties.m │ └── XLTestTextViewProperties.m │ ├── XLForm Tests-Info.plist │ ├── XLForm Tests-Prefix.pch │ └── en.lproj │ └── InfoPlist.strings ├── XLForm.png ├── XLForm.podspec ├── XLForm.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── XLForm.xcscheme └── XLForm ├── Info.plist ├── XL ├── NSArray+XLFormAdditions.h ├── NSArray+XLFormAdditions.m ├── NSExpression+XLFormAdditions.h ├── NSExpression+XLFormAdditions.m ├── NSObject+XLFormAdditions.h ├── NSObject+XLFormAdditions.m ├── NSPredicate+XLFormAdditions.h ├── NSPredicate+XLFormAdditions.m ├── NSString+XLFormAdditions.h ├── NSString+XLFormAdditions.m ├── UIView+XLFormAdditions.h ├── UIView+XLFormAdditions.m ├── XLForm.h ├── XLForm.m ├── XLFormBaseCell.h ├── XLFormBaseCell.m ├── XLFormButtonCell.h ├── XLFormButtonCell.m ├── XLFormCheckCell.h ├── XLFormCheckCell.m ├── XLFormDateCell.h ├── XLFormDateCell.m ├── XLFormDatePickerCell.h ├── XLFormDatePickerCell.m ├── XLFormDescriptor.h ├── XLFormDescriptor.m ├── XLFormDescriptorCell.h ├── XLFormDescriptorDelegate.h ├── XLFormImageCell.h ├── XLFormImageCell.m ├── XLFormInlineRowDescriptorCell.h ├── XLFormInlineSelectorCell.h ├── XLFormInlineSelectorCell.m ├── XLFormLeftRightSelectorCell.h ├── XLFormLeftRightSelectorCell.m ├── XLFormOptionsObject.h ├── XLFormOptionsObject.m ├── XLFormOptionsViewController.h ├── XLFormOptionsViewController.m ├── XLFormPickerCell.h ├── XLFormPickerCell.m ├── XLFormRegexValidator.h ├── XLFormRegexValidator.m ├── XLFormRightDetailCell.h ├── XLFormRightDetailCell.m ├── XLFormRightImageButton.h ├── XLFormRightImageButton.m ├── XLFormRowDescriptor.h ├── XLFormRowDescriptor.m ├── XLFormRowDescriptorViewController.h ├── XLFormRowNavigationAccessoryView.h ├── XLFormRowNavigationAccessoryView.m ├── XLFormSectionDescriptor.h ├── XLFormSectionDescriptor.m ├── XLFormSegmentedCell.h ├── XLFormSegmentedCell.m ├── XLFormSelectorCell.h ├── XLFormSelectorCell.m ├── XLFormSliderCell.h ├── XLFormSliderCell.m ├── XLFormStepCounterCell.h ├── XLFormStepCounterCell.m ├── XLFormSwitchCell.h ├── XLFormSwitchCell.m ├── XLFormTextFieldCell.h ├── XLFormTextFieldCell.m ├── XLFormTextView.h ├── XLFormTextView.m ├── XLFormTextViewCell.h ├── XLFormTextViewCell.m ├── XLFormValidationStatus.h ├── XLFormValidationStatus.m ├── XLFormValidator.h ├── XLFormValidator.m ├── XLFormValidatorProtocol.h ├── XLFormViewController.h └── XLFormViewController.m └── XLForm.bundle └── forwardarrow@2x.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: xmartlabs # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | 20 | #CocoaPods 21 | Pods 22 | Podfile.lock 23 | *.xcworkspace 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode12 3 | before_install: 4 | - gem install cocoapods --quiet 5 | - gem install xcpretty --quiet 6 | - cd Tests && pod install && cd $TRAVIS_BUILD_DIR 7 | script: rake test 8 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/AccessoryViews/AccessoryViewFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AccessoryViewFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface AccessoryViewFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface AppDelegate : UIResponder 29 | 30 | @property (strong, nonatomic) UIWindow *window; 31 | 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "ExamplesFormViewController.h" 27 | #import "AppDelegate.h" 28 | 29 | 30 | @implementation AppDelegate 31 | 32 | 33 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 34 | { 35 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 36 | // Override point for customization after application launch. 37 | self.window.backgroundColor = [UIColor whiteColor]; 38 | 39 | // load the initial form form Storybiard 40 | UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhoneStoryboard" bundle:nil]; 41 | [self.window setRootViewController:[storyboard instantiateInitialViewController]]; 42 | [self.window makeKeyAndVisible]; 43 | return YES; 44 | } 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/CustomRowsViewController.h: -------------------------------------------------------------------------------- 1 | // CustomRowsViewController.h 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLFormViewController.h" 26 | 27 | @interface CustomRowsViewController : XLFormViewController 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/FloatLabeledTextField/FloatLabeledTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // FloatLabeledTextFieldCell.h 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLFormBaseCell.h" 26 | 27 | extern NSString * const XLFormRowDescriptorTypeFloatLabeledTextField; 28 | 29 | @interface FloatLabeledTextFieldCell : XLFormBaseCell 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/Rating/RatingView/XLRatingView.h: -------------------------------------------------------------------------------- 1 | // XLRatingView.h 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface XLRatingView : AXRatingView 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/Rating/RatingView/XLRatingView.m: -------------------------------------------------------------------------------- 1 | // XLRatingView.m 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLRatingView.h" 26 | 27 | @implementation XLRatingView 28 | 29 | - (instancetype)init 30 | { 31 | self = [super init]; 32 | if (self) { 33 | [self customize]; 34 | } 35 | return self; 36 | } 37 | 38 | - (instancetype)initWithFrame:(CGRect)frame 39 | { 40 | self = [super initWithFrame:frame]; 41 | if (self) { 42 | [self customize]; 43 | } 44 | return self; 45 | } 46 | 47 | - (id)initWithCoder:(NSCoder *)aDecoder 48 | { 49 | self = [super initWithCoder:aDecoder]; 50 | if (self) { 51 | [self customize]; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)customize 57 | { 58 | self.baseColor = [UIColor colorWithRed:(205/255.0) green:(201/255.0) blue:(201/255.0) alpha:1]; 59 | self.highlightColor = [UIColor colorWithRed:(255/255.0) green:(215/255.0) blue:0 alpha:1]; 60 | self.markFont = [UIFont systemFontOfSize:23.0f]; 61 | self.translatesAutoresizingMaskIntoConstraints = NO; 62 | self.stepInterval = 1.0f; 63 | } 64 | 65 | @end 66 | 67 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/Rating/XLFormRatingCell.h: -------------------------------------------------------------------------------- 1 | // XLFormRatingCell.h 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLFormBaseCell.h" 26 | #import "XLRatingView.h" 27 | 28 | extern NSString * const XLFormRowDescriptorTypeRate; 29 | 30 | @interface XLFormRatingCell : XLFormBaseCell 31 | 32 | @property (weak, nonatomic) IBOutlet UILabel *rateTitle; 33 | @property (weak, nonatomic) IBOutlet XLRatingView *ratingView; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/Rating/XLFormRatingCell.m: -------------------------------------------------------------------------------- 1 | // XLFormRatingCell.m 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLFormRatingCell.h" 26 | 27 | NSString * const XLFormRowDescriptorTypeRate = @"XLFormRowDescriptorTypeRate"; 28 | 29 | @implementation XLFormRatingCell 30 | 31 | +(void)load 32 | { 33 | [XLFormViewController.cellClassesForRowDescriptorTypes setObject:NSStringFromClass([XLFormRatingCell class]) forKey:XLFormRowDescriptorTypeRate]; 34 | } 35 | 36 | - (void)configure 37 | { 38 | [super configure]; 39 | 40 | self.selectionStyle = UITableViewCellSelectionStyleNone; 41 | [self.ratingView addTarget:self action:@selector(rateChanged:) forControlEvents:UIControlEventValueChanged]; 42 | } 43 | 44 | - (void)update 45 | { 46 | [super update]; 47 | 48 | self.ratingView.value = [self.rowDescriptor.value floatValue]; 49 | self.rateTitle.text = self.rowDescriptor.title; 50 | 51 | [self.ratingView setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)]; 52 | [self.rateTitle setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)]; 53 | } 54 | 55 | #pragma mark - Events 56 | 57 | -(void)rateChanged:(AXRatingView *)ratingView 58 | { 59 | self.rowDescriptor.value = [NSNumber numberWithFloat:ratingView.value]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/CustomRows/Weekdays/XLFormWeekDaysCell.h: -------------------------------------------------------------------------------- 1 | // XLFormWeekDaysCell.h 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "XLFormBaseCell.h" 26 | 27 | extern NSString * const XLFormRowDescriptorTypeWeekDays; 28 | 29 | extern NSString *const kSunday; 30 | extern NSString *const kMonday; 31 | extern NSString *const kTuesday; 32 | extern NSString *const kWednesday; 33 | extern NSString *const kThursday; 34 | extern NSString *const kFriday; 35 | extern NSString *const kSaturday; 36 | 37 | @interface XLFormWeekDaysCell : XLFormBaseCell 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Dates/DateAndTimeValueTrasformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DateAndTimeValueTransformer.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface DateValueTrasformer : NSValueTransformer 29 | @end 30 | 31 | @interface DateTimeValueTrasformer : NSValueTransformer 32 | @end 33 | 34 | @interface DateAndTimeValueTrasformer : NSValueTransformer 35 | @end 36 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Dates/DatesFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DatesFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface DatesFormViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Dates/XLForm-Dates.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Dates/XLForm-Dates.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/ExamplesFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExamplesFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface ExamplesFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Formatters/FormattersViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FormattersViewController.h 3 | // XLForm 4 | // 5 | // Created by Freddy Henin on 12/29/14. 6 | // Copyright (c) 2014 Xmartlabs. All rights reserved. 7 | // 8 | 9 | #import "XLFormViewController.h" 10 | 11 | @interface FormattersViewController : XLFormViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Inputs/InputsFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // InputsFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface InputsFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Inputs/XLForm-Inputs.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Inputs/XLForm-Inputs.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/MultiValuedSections/MultivaluedFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultiValuedFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface MultivaluedFormViewController : XLFormViewController 29 | 30 | @end 31 | 32 | 33 | @interface MultivaluedOnlyReorderViewController : XLFormViewController 34 | 35 | @end 36 | 37 | 38 | @interface MultivaluedOnlyInserViewController : XLFormViewController 39 | 40 | @end 41 | 42 | 43 | @interface MultivaluedOnlyDeleteViewController : XLFormViewController 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/MultiValuedSections/XLForm-MultiValuedSections.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/MultiValuedSections/XLForm-MultiValuedSections.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/CustomCells/XLFormCustomCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormCustomCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormCustomCell : XLFormBaseCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/CustomCells/XLFormCustomCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormCustomCell.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormCustomCell.h" 27 | 28 | @implementation XLFormCustomCell 29 | 30 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 31 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 32 | if (self) { 33 | // Initialization code 34 | } 35 | return self; 36 | } 37 | 38 | - (void)configure 39 | { 40 | [super configure]; 41 | //override 42 | } 43 | 44 | - (void)update 45 | { 46 | [super update]; 47 | // override 48 | self.textLabel.text = @"Am a custom cell, select me!"; 49 | } 50 | 51 | -(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller 52 | { 53 | // custom code here 54 | // i.e new behaviour when cell has been selected 55 | self.textLabel.text = [self.textLabel.text isEqualToString:@"I can do any custom behaviour..."] ? @"Am a custom cell, select me!" : @"I can do any custom behaviour..."; 56 | self.rowDescriptor.value = self.textLabel.text; 57 | [self.formViewController.tableView selectRowAtIndexPath:nil animated:YES scrollPosition:UITableViewScrollPositionNone]; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/CustomCells/XLFormImageSelectorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormImageSelectorCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | NSString *const kFormImageSelectorCellDefaultImage; 29 | NSString *const kFormImageSelectorCellImageRequest; 30 | 31 | @interface XLFormImageSelectorCell : XLFormBaseCell 32 | 33 | @property (nonatomic, readonly) UIImageView * imageView; 34 | @property (nonatomic, readonly) UILabel * textLabel; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/OthersFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OthersFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface OthersFormViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/XLForm-Boolean.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Others/XLForm-Boolean.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Others/XLForm-stepCounter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Others/XLForm-stepCounter.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/PredicateExamples/BasicPredicateViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BasicPredicateViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface BasicPredicateViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/PredicateExamples/BlogExampleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BlogExampleViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface BlogExampleViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/PredicateExamples/PredicateFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PredicateFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface PredicateFormViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/PredicateExamples/XLFormPredicates.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/PredicateExamples/XLFormPredicates.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/PredicateExamples/XLFormPredicatesBasic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/PredicateExamples/XLFormPredicatesBasic.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/RealExamples/NativeEventFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NativeEventNavigationViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface NativeEventNavigationViewController : UINavigationController 29 | 30 | @end 31 | 32 | @interface NativeEventFormViewController : XLFormViewController 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/RealExamples/XLForm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/RealExamples/XLForm.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/CustomSelectorsFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CustomSelectorsFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface CustomSelectorsFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CLLocationValueTrasformer.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface CLLocationValueTrasformer : NSValueTransformer 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CLLocationValueTrasformer.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | #import "CLLocationValueTrasformer.h" 28 | 29 | @implementation CLLocationValueTrasformer 30 | 31 | + (Class)transformedValueClass 32 | { 33 | return [NSString class]; 34 | } 35 | 36 | + (BOOL)allowsReverseTransformation 37 | { 38 | return NO; 39 | } 40 | 41 | - (id)transformedValue:(id)value 42 | { 43 | if (!value) return nil; 44 | CLLocation * location = (CLLocation *)value; 45 | return [NSString stringWithFormat:@"%0.4f, %0.4f", location.coordinate.latitude, location.coordinate.longitude]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MapViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | 28 | #import 29 | 30 | @interface MapViewController : UIViewController 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/XLForm-map-custom-selector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Selectors/CustomSelectors/XLFormRowViewController/XLForm-map-custom-selector.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/DynamicSelector/DynamicSelectorsFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DynamicSelectorsFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface DynamicSelectorsFormViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/DynamicSelector/UsersTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UsersTableViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRowDescriptor.h" 27 | #import "XLRemoteDataStoreController.h" 28 | 29 | @interface UsersTableViewController : XLRemoteDataStoreController 30 | 31 | @property BOOL isSearchResultsController; 32 | @property NSLayoutConstraint *topConstraint; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/DynamicSelector/XLForm-dynamic-custom-selector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Selectors/DynamicSelector/XLForm-dynamic-custom-selector.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/HTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPSessionManager.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "AFHTTPSessionManager.h" 27 | 28 | @interface HTTPSessionManager : AFHTTPSessionManager 29 | 30 | + (HTTPSessionManager *)sharedClient; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/HTTPSessionManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // HTTPSessionManager.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "HTTPSessionManager.h" 27 | 28 | @implementation HTTPSessionManager 29 | 30 | // Server Base URL 31 | static NSString * const APIBaseURLString = @"http://obscure-refuge-3149.herokuapp.com"; 32 | 33 | + (instancetype)sharedClient { 34 | static HTTPSessionManager *_sharedClient = nil; 35 | static dispatch_once_t onceToken; 36 | dispatch_once(&onceToken, ^{ 37 | _sharedClient = [[HTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:APIBaseURLString]]; 38 | [_sharedClient.reachabilityManager startMonitoring]; 39 | _sharedClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; 40 | }); 41 | 42 | return _sharedClient; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/Helpers/Data/Model.xcdatamodeld/Model.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/SelectorsFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SelectorsFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormViewController.h" 28 | 29 | @interface SelectorsFormViewController : XLFormViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Selectors/XLForm-Selectors.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/Examples/Selectors/XLForm-Selectors.gif -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/UICustomization/UICustomizationFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UICustomizationFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface UICustomizationFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Examples/Validations/ValidationExamplesFormViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ValidationExamplesFormViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormViewController.h" 27 | 28 | @interface ValidationExamplesFormViewController : XLFormViewController 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormInlineSegmentedCell.h 3 | // XLForm 4 | // 5 | // Created by mathias Claassen on 16/12/15. 6 | // Copyright © 2015 Xmartlabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * const XLFormRowDescriptorTypeSegmentedInline; 12 | extern NSString * const XLFormRowDescriptorTypeSegmentedControl; 13 | 14 | @interface XLFormInlineSegmentedCell : XLFormBaseCell 15 | 16 | @end 17 | 18 | 19 | @interface XLFormInlineSegmentedControl : XLFormBaseCell 20 | 21 | @property (strong, nonatomic) UISegmentedControl* segmentedControl; 22 | @end -------------------------------------------------------------------------------- /Examples/Objective-C/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | platform :ios, '9.0' 3 | 4 | target 'XLForm' do 5 | 6 | pod 'XLForm', :path => '../../' 7 | 8 | #Following pods are used for custom row examples 9 | pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true 10 | pod 'XLData', :git => 'https://github.com/xmartlabs/XLData.git', :commit => '1f9019b56242a2019c7f7e11ec4ef823c397ebcf', :inhibit_warnings => true 11 | pod 'JVFloatLabeledTextField', '1.0.2', :inhibit_warnings => true 12 | pod 'AXRatingView', '1.0.3', :inhibit_warnings => true 13 | pod 'SHSPhoneComponent' 14 | end 15 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_114.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_152.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_57.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/AppIcon.appiconset/xl_appicon_76.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "extent" : "full-screen", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "filename" : "xl_splash@2x.png", 15 | "minimum-system-version" : "7.0", 16 | "orientation" : "portrait", 17 | "scale" : "2x" 18 | } 19 | ], 20 | "info" : { 21 | "version" : 1, 22 | "author" : "xcode" 23 | } 24 | } -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/Star.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "Star.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/Star.imageset/Star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/Star.imageset/Star.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/checkedDay.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "vweekday.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/checkedDay.imageset/vweekday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/checkedDay.imageset/vweekday.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/default_avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "default-avatar@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/default_avatar.imageset/default-avatar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/default_avatar.imageset/default-avatar@2x.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/uncheckedDay.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "xweekday.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/Images.xcassets/uncheckedDay.imageset/xweekday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Objective-C/XLForm/Images.xcassets/uncheckedDay.imageset/xweekday.png -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/XLForm-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleDisplayName 13 | ${PRODUCT_NAME} 14 | CFBundleExecutable 15 | ${EXECUTABLE_NAME} 16 | CFBundleIdentifier 17 | $(PRODUCT_BUNDLE_IDENTIFIER) 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | ${PRODUCT_NAME} 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | 3.0.1 26 | CFBundleSignature 27 | ???? 28 | CFBundleVersion 29 | 3.0.1 30 | LSRequiresIPhoneOS 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/XLForm-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | XLForm 4 | 5 | Created by Martin Barreto on 4/4/14. 6 | Copyright (c) 2015 Xmartlabs. All rights reserved. 7 | */ 8 | 9 | 10 | "XLFormViewController_ValidationErrorTitle" = "Oops!"; 11 | "XLFormController_DeleteConfirmation" = "Are you sure?"; 12 | 13 | 14 | -------------------------------------------------------------------------------- /Examples/Objective-C/XLForm/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Examples/Swift/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | 3 | target 'SwiftExample' do 4 | 5 | pod 'XLForm', :path => '../../' 6 | pod 'JVFloatLabeledTextField', '1.0.2', :inhibit_warnings => true 7 | pod 'AXRatingView', '1.0.3', :inhibit_warnings => true 8 | 9 | end 10 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/CustomRows/Rating/RatingView/XLRatingView.swift: -------------------------------------------------------------------------------- 1 | // XLRatingView.swift 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | 26 | class XLRatingView : AXRatingView { 27 | 28 | override init(frame: CGRect) { 29 | super.init(frame: frame) 30 | translatesAutoresizingMaskIntoConstraints = false 31 | } 32 | 33 | required init?(coder aDecoder: NSCoder) { 34 | super.init(coder: aDecoder) 35 | translatesAutoresizingMaskIntoConstraints = false 36 | } 37 | 38 | 39 | func customize() { 40 | baseColor = UIColor(red: (205/255.0), green: (201/255.0), blue: (201/255.0), alpha: 1) 41 | highlightColor = UIColor(red: (255/255.0), green: (215/255.0), blue: 0, alpha: 1) 42 | markFont = UIFont.systemFont(ofSize: 23.0) 43 | stepInterval = 1.0 44 | } 45 | 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/CustomRows/Rating/XLFormRatingCell.swift: -------------------------------------------------------------------------------- 1 | // XLFormRatingCell.swift 2 | // XLForm ( https://github.com/xmartlabs/XLForm ) 3 | // 4 | // Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com ) 5 | // 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | 26 | let XLFormRowDescriptorTypeRate = "XLFormRowDescriptorTypeRate" 27 | 28 | 29 | class XLFormRatingCell : XLFormBaseCell { 30 | 31 | @IBOutlet weak var rateTitle: UILabel! 32 | @IBOutlet weak var ratingView: XLRatingView! 33 | 34 | 35 | override func configure() { 36 | super.configure() 37 | selectionStyle = .none 38 | ratingView.addTarget(self, action: #selector(XLFormRatingCell.rateChanged(_:)), for:.valueChanged) 39 | } 40 | 41 | 42 | override func update() { 43 | super.update() 44 | ratingView.value = (rowDescriptor!.value! as AnyObject).floatValue 45 | rateTitle.text = rowDescriptor!.title 46 | ratingView.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1 47 | rateTitle.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1 48 | } 49 | 50 | //MARK: Events 51 | 52 | @objc func rateChanged(_ ratingView : XLRatingView){ 53 | rowDescriptor!.value = ratingView.value 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CLLocationValueTrasformer.swift 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | import MapKit 28 | 29 | class CLLocationValueTrasformer : ValueTransformer { 30 | 31 | override class func transformedValueClass() -> AnyClass { 32 | return NSString.self 33 | } 34 | 35 | 36 | override class func allowsReverseTransformation() -> Bool { 37 | return false 38 | } 39 | 40 | override func transformedValue(_ value: Any?) -> Any? { 41 | if let valueData = value, let location = valueData as? CLLocation{ 42 | return String(format: "%0.4f, %0.4f", location.coordinate.latitude, location.coordinate.longitude) 43 | } 44 | return nil 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/CustomSelectors/XLFormRowViewController/MapViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Dates/DateAndTimeValueTrasformer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DateAndTimeValueTransformer.swift 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | class DateValueTrasformer : ValueTransformer { 27 | 28 | override class func transformedValueClass() -> AnyClass { 29 | return NSString.self 30 | } 31 | 32 | 33 | override class func allowsReverseTransformation() -> Bool { 34 | return false 35 | } 36 | 37 | override func transformedValue(_ value: Any?) -> Any? { 38 | if let date = value as? Date { 39 | let dateFormatter = DateFormatter() 40 | dateFormatter.dateStyle = .full 41 | dateFormatter.timeStyle = .none 42 | return dateFormatter.string(from: date) 43 | } 44 | return nil 45 | } 46 | } 47 | 48 | class DateTimeValueTrasformer: ValueTransformer { 49 | 50 | override class func transformedValueClass() -> AnyClass { 51 | return NSString.self 52 | } 53 | 54 | 55 | override class func allowsReverseTransformation() -> Bool { 56 | return false 57 | } 58 | 59 | override func transformedValue(_ value: Any?) -> Any? { 60 | if let date = value as? Date { 61 | let dateFormatter = DateFormatter() 62 | dateFormatter.dateStyle = .medium 63 | dateFormatter.timeStyle = .short 64 | return dateFormatter.string(from: date) 65 | } 66 | return nil 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "xl_appicon_58.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "xl_appicon_87.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "xl_appicon_80-1.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "xl_appicon_120-1.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "xl_appicon_120.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "3x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "29x29", 46 | "scale" : "2x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "1x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "40x40", 56 | "scale" : "2x" 57 | }, 58 | { 59 | "size" : "76x76", 60 | "idiom" : "ipad", 61 | "filename" : "xl_appicon_76.png", 62 | "scale" : "1x" 63 | }, 64 | { 65 | "size" : "76x76", 66 | "idiom" : "ipad", 67 | "filename" : "xl_appicon_152.png", 68 | "scale" : "2x" 69 | }, 70 | { 71 | "idiom" : "ipad", 72 | "size" : "83.5x83.5", 73 | "scale" : "2x" 74 | } 75 | ], 76 | "info" : { 77 | "version" : 1, 78 | "author" : "xcode" 79 | } 80 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_120-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_120-1.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_120.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_152.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_58.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_76.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_80.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/AppIcon.appiconset/xl_appicon_87.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "extent" : "full-screen", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "filename" : "xl_splash@2x.png", 15 | "minimum-system-version" : "7.0", 16 | "orientation" : "portrait", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "orientation" : "portrait", 21 | "idiom" : "ipad", 22 | "extent" : "full-screen", 23 | "minimum-system-version" : "7.0", 24 | "scale" : "1x" 25 | }, 26 | { 27 | "orientation" : "landscape", 28 | "idiom" : "ipad", 29 | "extent" : "full-screen", 30 | "minimum-system-version" : "7.0", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "orientation" : "portrait", 35 | "idiom" : "ipad", 36 | "extent" : "full-screen", 37 | "minimum-system-version" : "7.0", 38 | "scale" : "2x" 39 | }, 40 | { 41 | "orientation" : "landscape", 42 | "idiom" : "ipad", 43 | "extent" : "full-screen", 44 | "minimum-system-version" : "7.0", 45 | "scale" : "2x" 46 | } 47 | ], 48 | "info" : { 49 | "version" : 1, 50 | "author" : "xcode" 51 | } 52 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/LaunchImage.launchimage/xl_splash@2x.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Apu_Nahasapeemapetilon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Apu_Nahasapeemapetilon.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Apu_Nahasapeemapetilon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Apu_Nahasapeemapetilon.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Bart_Simpsons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Bart_Simpsons.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Bart_Simpsons.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Bart_Simpsons.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Homer_Simpsons.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Homer_Simpsons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Homer_Simpsons.imageset/Homer_Simpsons.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Lisa_Simpsons.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Lisa_Simpsons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Lisa_Simpsons.imageset/Lisa_Simpsons.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Maggie_Simpsons.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Maggie_Simpsons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Maggie_Simpsons.imageset/Maggie_Simpsons.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Marge_Simpsons.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Marge_Simpsons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Marge_Simpsons.imageset/Marge_Simpsons.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Montgomery_Burns.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Montgomery_Burns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Montgomery_Burns.imageset/Montgomery_Burns.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Ned_Flanders.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Ned_Flanders.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Ned_Flanders.imageset/Ned_Flanders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Ned_Flanders.imageset/Ned_Flanders.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Otto_Mann.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Otto_Mann.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Otto_Mann.imageset/Otto_Mann.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/Otto_Mann.imageset/Otto_Mann.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/default-avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "default-avatar@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/Simpsons/default-avatar.imageset/default-avatar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/Simpsons/default-avatar.imageset/default-avatar@2x.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/checkedDay.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "vweekday.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/checkedDay.imageset/vweekday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/checkedDay.imageset/vweekday.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/default_avatar.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "default-avatar@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/default_avatar.imageset/default-avatar@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/default_avatar.imageset/default-avatar@2x.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/uncheckedDay.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "xweekday.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Images.xcassets/uncheckedDay.imageset/xweekday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/Examples/Swift/SwiftExample/Images.xcassets/uncheckedDay.imageset/xweekday.png -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 3.0 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | iPhoneStoryboard 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/Others/CustomCells/XLFormCustomCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormCustomCell.swift 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | let XLFormRowDescriptorTypeCustom = "XLFormRowDescriptorTypeCustom" 27 | 28 | class XLFormCustomCell : XLFormBaseCell { 29 | 30 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 31 | super.init(style: style, reuseIdentifier: reuseIdentifier) 32 | } 33 | 34 | required init?(coder aDecoder: NSCoder) { 35 | super.init(coder: aDecoder) 36 | } 37 | 38 | override func configure() { 39 | super.configure() 40 | } 41 | 42 | override func update() { 43 | super.update() 44 | // override 45 | if let string = rowDescriptor?.value as? String { 46 | textLabel?.text = string 47 | } 48 | else { 49 | textLabel?.text = "Am a custom cell, select me!" 50 | } 51 | } 52 | 53 | override func formDescriptorCellDidSelected(withForm controller: XLFormViewController!) { 54 | // custom code here 55 | // i.e new behaviour when cell has been selected 56 | if let string = rowDescriptor?.value as? String , string == "Am a custom cell, select me!" { 57 | self.rowDescriptor?.value = string 58 | } 59 | else { 60 | self.rowDescriptor?.value = "I can do any custom behaviour..." 61 | } 62 | 63 | update() 64 | controller.tableView.selectRow(at: nil, animated: true, scrollPosition: .none) 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Examples/Swift/SwiftExample/SwiftExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftExample-Bridging-Header.h 3 | // SwiftExample 4 | // 5 | // Created by Martin Barreto on 3/10/15. 6 | // Copyright (c) 2014-2015 Xmartlabs. All rights reserved. 7 | // 8 | 9 | #ifndef SwiftExample_SwiftExample_Bridging_Header_h_h 10 | #define SwiftExample_SwiftExample_Bridging_Header_h_h 11 | 12 | 13 | #import 14 | #import 15 | #import 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Xmartlabs ( http://xmartlabs.com ) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.2 2 | import PackageDescription 3 | 4 | let package = Package( 5 | name: "XLForm", 6 | platforms: [ 7 | .iOS(.v9) 8 | ], 9 | products: [ 10 | .library(name: "XLForm", targets: ["XLForm"]) 11 | ], 12 | dependencies: [], 13 | targets: [ 14 | .target( 15 | name: "XLForm", 16 | dependencies: [], 17 | path: "XLForm", 18 | publicHeadersPath: "XL" 19 | ) 20 | ] 21 | ) 22 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | include FileUtils::Verbose 2 | 3 | namespace :test do 4 | desc "Run the XLForm Tests" 5 | task :ios do 6 | run_tests('XLForm Tests', 'iphonesimulator') 7 | tests_failed unless $?.success? 8 | end 9 | end 10 | 11 | task :test do 12 | Rake::Task['test:ios'].invoke 13 | end 14 | 15 | task :default => 'test' 16 | 17 | private 18 | 19 | def run_tests(scheme, sdk) 20 | sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'OS=14.0,name=iPhone 11' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil 21 | end 22 | 23 | def tests_failed 24 | puts red("Unit tests failed") 25 | exit $?.exitstatus 26 | end 27 | 28 | def red(string) 29 | "\033[0;31m! #{string}" 30 | end 31 | -------------------------------------------------------------------------------- /Tests/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://cdn.cocoapods.org/' 2 | project 'XLForm Tests' 3 | inhibit_all_warnings! 4 | 5 | platform :ios, '9.0' 6 | 7 | target 'XLForm Tests' do 8 | pod 'Expecta', '~> 1.0' 9 | pod 'XLForm', :path => '../' 10 | end 11 | -------------------------------------------------------------------------------- /Tests/XLForm Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/XLForm Tests.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Helpers/UITextField+Test.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+Test.h 3 | // XLForm Tests 4 | // 5 | // Created by Gaston Borba on 3/25/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface UITextField (Test) 12 | 13 | // This category is for simulate the change of the text 14 | -(void)changeText:(NSString *)string; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Helpers/UITextField+Test.m: -------------------------------------------------------------------------------- 1 | // 2 | // UITextField+Test.m 3 | // XLForm Tests 4 | // 5 | // Created by Gaston Borba on 3/25/15. 6 | // 7 | // 8 | 9 | #import "UITextField+Test.h" 10 | 11 | @implementation UITextField (Test) 12 | 13 | - (void)beginEditing 14 | { 15 | [self becomeFirstResponder]; // Returns NO ? 16 | 17 | if ([self textFieldShouldBeginEditing]){ 18 | if ([self.delegate respondsToSelector:@selector(textFieldDidBeginEditing:)]) { 19 | [self.delegate textFieldDidBeginEditing:self]; 20 | } 21 | } 22 | } 23 | 24 | - (void)endEditing 25 | { 26 | if ([self textFieldShouldReturn]) { 27 | if ([self.delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) { 28 | [self.delegate textFieldDidEndEditing:self]; 29 | } 30 | [self resignFirstResponder]; 31 | } 32 | } 33 | 34 | 35 | -(BOOL)textFieldShouldReturn 36 | { 37 | if ([self.delegate respondsToSelector:@selector(textFieldShouldReturn:)]) { 38 | return [self.delegate textFieldShouldReturn:self]; 39 | } 40 | return YES; 41 | } 42 | 43 | -(BOOL)textFieldShouldBeginEditing 44 | { 45 | if ([self.delegate respondsToSelector:@selector(textFieldShouldBeginEditing:)]) { 46 | return [self.delegate textFieldShouldBeginEditing:self]; 47 | } 48 | return YES; 49 | } 50 | 51 | -(void)changeText:(NSString *)string 52 | { 53 | [self beginEditing]; 54 | [self setText:string]; 55 | [self endEditing]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Test/XLFormValidatorsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidatorsTests.m 3 | // XLForm Tests 4 | // 5 | // Created by Martin Barreto on 8/5/14. 6 | // 7 | // 8 | 9 | #import "XLTestCase.h" 10 | #import 11 | 12 | @interface XLFormValidatorsTests : XLTestCase 13 | 14 | @end 15 | 16 | @implementation XLFormValidatorsTests 17 | 18 | - (void)setUp 19 | { 20 | [super setUp]; 21 | [self buildForm]; 22 | } 23 | 24 | - (void)tearDown 25 | { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | [super tearDown]; 28 | } 29 | 30 | - (void)testRequiredTextField 31 | { 32 | XLFormRowDescriptor * rowDescriptor = [self.formController.form formRowWithTag:XLFormRowDescriptorTypeText]; 33 | 34 | expect([rowDescriptor doValidation].isValid).to.beFalsy(); 35 | } 36 | 37 | 38 | #pragma mark - Build Form 39 | 40 | -(void)buildForm 41 | { 42 | XLFormDescriptor * form = [XLFormDescriptor formDescriptor]; 43 | XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection]; 44 | [form addFormSection:section]; 45 | 46 | XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:XLFormRowDescriptorTypeText rowType:XLFormRowDescriptorTypeText title:@"Title"]; 47 | row.required = YES; 48 | [section addFormRow:row]; 49 | 50 | self.formController.form = form; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Test/XLTestCase.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormTestCase.h 3 | // XLForm Tests 4 | // 5 | // Created by Martin Barreto on 8/5/14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #define EXP_SHORTHAND YES 12 | #import "Expecta.h" 13 | 14 | #import 15 | #import 16 | 17 | @interface XLTestCase : XCTestCase 18 | 19 | @property (nonatomic, strong) XLFormViewController * formController; 20 | 21 | -(void)buildForm; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Test/XLTestCase.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormTestCase.m 3 | // XLForm Tests 4 | // 5 | // Created by Martin Barreto on 8/5/14. 6 | // 7 | // 8 | 9 | #import "XLTestCase.h" 10 | 11 | @implementation XLTestCase 12 | 13 | - (void)setUp { 14 | [super setUp]; 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | [self buildForm]; 17 | [self forceLoadingOfTheView]; // Load the view 18 | } 19 | 20 | - (void)tearDown { 21 | // Put teardown code here. This method is called after the invocation of each test method in the class. 22 | self.formController = nil; 23 | [super tearDown]; 24 | } 25 | 26 | 27 | #pragma mark - Helpers 28 | 29 | -(void)buildForm 30 | { 31 | } 32 | 33 | 34 | -(XLFormViewController *)formController 35 | { 36 | if (_formController) return _formController; 37 | _formController = [[XLFormViewController alloc] init]; 38 | return _formController; 39 | } 40 | 41 | 42 | - (void)forceLoadingOfTheView 43 | { 44 | // This triggers to load the view 45 | expect(self.formController.view).notTo.beNil(); 46 | self.formController.view.frame = CGRectMake(0, 0, 375, 667); 47 | [self.formController.view layoutIfNeeded]; 48 | // [self.formController.tableView reloadData]; 49 | } 50 | 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Test/XLTestTextFieldProperties.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLTestTextFieldProperties.m 3 | // XLForm Tests 4 | // 5 | // Created by Claus on 9/5/16. 6 | // 7 | // 8 | 9 | #import "XLTestCase.h" 10 | #import 11 | #import 12 | 13 | @interface XLTestTextFieldProperties : XLTestCase 14 | @end 15 | 16 | @implementation XLTestTextFieldProperties 17 | 18 | - (void)testPropertiesGetSet 19 | { 20 | // Get the tableView 21 | UITableView * tableView = self.formController.tableView; 22 | 23 | UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 24 | 25 | // Check if the cell contains the correct properties 26 | expect(cell).to.beKindOf([XLFormTextFieldCell class]); 27 | XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell; 28 | expect(textFieldCell.textFieldLengthPercentage).to.equal(0.3); 29 | expect(textFieldCell.textFieldMaxNumberOfCharacters).to.equal(10); 30 | } 31 | 32 | - (void)testMaxNumbersOfCharacters 33 | { 34 | // Get the tableView 35 | UITableView * tableView = self.formController.tableView; 36 | 37 | UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 38 | expect(cell).to.beKindOf([XLFormTextFieldCell class]); 39 | XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell; 40 | 41 | // Check if range check works 42 | expect(cell).to.conformTo(@protocol(UITextFieldDelegate)); 43 | id textFieldDelegate = (id)cell; 44 | NSRange range = NSMakeRange(0, 0); 45 | expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"123"]).to.beTruthy(); 46 | expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"1234567890"]).to.beTruthy(); 47 | expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"12345678901"]).to.beFalsy(); 48 | } 49 | 50 | #pragma mark - Build Form 51 | 52 | -(void)buildForm 53 | { 54 | XLFormDescriptor * form = [XLFormDescriptor formDescriptor]; 55 | XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection]; 56 | [form addFormSection:section]; 57 | 58 | XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText]; 59 | [row.cellConfigAtConfigure setObject:@(0.3) forKey:XLFormTextFieldLengthPercentage]; 60 | [row.cellConfigAtConfigure setObject:@(10) forKey:XLFormTextFieldMaxNumberOfCharacters]; 61 | [section addFormRow:row]; 62 | 63 | self.formController.form = form; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/Test/XLTestTextViewProperties.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLTestTextViewProperties.m 3 | // XLForm Tests 4 | // 5 | // Created by Claus on 9/5/16. 6 | // 7 | // 8 | 9 | #import "XLTestCase.h" 10 | #import 11 | #import 12 | 13 | @interface XLTestTextViewProperties : XLTestCase 14 | @end 15 | 16 | @implementation XLTestTextViewProperties 17 | 18 | - (void)testPropertiesGetSet 19 | { 20 | // Get the tableView 21 | UITableView * tableView = self.formController.tableView; 22 | 23 | UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 24 | 25 | // Check if the cell contains the correct properties 26 | expect(cell).to.beKindOf([XLFormTextViewCell class]); 27 | XLFormTextViewCell * textViewCell = (XLFormTextViewCell *)cell; 28 | expect(textViewCell.textViewLengthPercentage).to.equal(0.3); 29 | expect(textViewCell.textViewMaxNumberOfCharacters).to.equal(10); 30 | } 31 | 32 | - (void)testMaxNumbersOfCharacters 33 | { 34 | // Get the tableView 35 | UITableView * tableView = self.formController.tableView; 36 | 37 | UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 38 | expect(cell).to.beKindOf([XLFormTextViewCell class]); 39 | XLFormTextViewCell * textViewCell = (XLFormTextViewCell *)cell; 40 | 41 | // Check if range check works 42 | expect(cell).to.conformTo(@protocol(UITextViewDelegate)); 43 | id textFieldDelegate = (id)cell; 44 | NSRange range = NSMakeRange(0, 0); 45 | expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"123"]).to.beTruthy(); 46 | expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"1234567890"]).to.beTruthy(); 47 | expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"12345678901"]).to.beFalsy(); 48 | } 49 | 50 | #pragma mark - Build Form 51 | 52 | -(void)buildForm 53 | { 54 | XLFormDescriptor * form = [XLFormDescriptor formDescriptor]; 55 | XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection]; 56 | [form addFormSection:section]; 57 | 58 | XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeTextView]; 59 | [row.cellConfigAtConfigure setObject:@(0.3) forKey:XLFormTextViewLengthPercentage]; 60 | [row.cellConfigAtConfigure setObject:@(10) forKey:XLFormTextViewMaxNumberOfCharacters]; 61 | [section addFormRow:row]; 62 | 63 | self.formController.form = form; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/XLForm Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/XLForm Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #endif 11 | -------------------------------------------------------------------------------- /Tests/XLForm Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /XLForm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/XLForm.png -------------------------------------------------------------------------------- /XLForm.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'XLForm' 3 | s.version = '4.3.0' 4 | s.license = { :type => 'MIT' } 5 | s.summary = 'XLForm is the most flexible and powerful iOS library to create dynamic table-view forms.' 6 | s.description = <<-DESC 7 | The goal of the library is to get the same power of hand-made forms but spending 1/10 of the time. XLForm provides a very powerful DSL used to create a form, validate & serialize the form data. It keeps track of this specification on runtime, updating the UI on the fly. 8 | DESC 9 | s.homepage = 'https://github.com/xmartlabs/XLForm' 10 | s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com' } 11 | s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => s.version } 12 | s.source_files = 'XLForm/XL/**/*.{h,m}' 13 | s.requires_arc = true 14 | s.ios.deployment_target = '9.0' 15 | s.ios.frameworks = 'UIKit', 'Foundation', 'CoreGraphics' 16 | s.resource = 'XLForm/XLForm.bundle' 17 | end 18 | -------------------------------------------------------------------------------- /XLForm.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XLForm.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XLForm/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /XLForm/XL/NSArray+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface NSArray (XLFormAdditions) 29 | 30 | -(NSInteger)formIndexForItem:(nonnull id)item; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /XLForm/XL/NSArray+XLFormAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+XLFormAdditions.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "NSArray+XLFormAdditions.h" 27 | #import "NSObject+XLFormAdditions.h" 28 | 29 | @implementation NSArray (XLFormAdditions) 30 | 31 | -(NSInteger)formIndexForItem:(nonnull id)item 32 | { 33 | for (id selectedValueItem in self) { 34 | if ([[selectedValueItem valueData] isEqual:[item valueData]]){ 35 | return [self indexOfObject:selectedValueItem]; 36 | } 37 | } 38 | return NSNotFound; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /XLForm/XL/NSExpression+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSExpression+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | 29 | @interface NSExpression (XLFormAdditions) 30 | 31 | -(nullable NSMutableArray*) getExpressionVars; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /XLForm/XL/NSExpression+XLFormAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSExpression+XLFormAdditions.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "NSExpression+XLFormAdditions.h" 28 | 29 | @implementation NSExpression (XLFormAdditions) 30 | 31 | 32 | -(nullable NSMutableArray*) getExpressionVars{ 33 | switch (self.expressionType) { 34 | case NSFunctionExpressionType:{ 35 | NSString* str = [NSString stringWithFormat:@"%@", self]; 36 | if ([str rangeOfString:@"."].location != NSNotFound) 37 | str = [str substringWithRange:NSMakeRange(1, [str rangeOfString:@"."].location - 1)]; 38 | else 39 | str = [str substringFromIndex:1]; 40 | return [[NSMutableArray alloc] initWithObjects: str, nil]; 41 | } 42 | default: 43 | return nil; 44 | } 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /XLForm/XL/NSObject+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface NSObject (XLFormAdditions) 29 | 30 | -(nullable NSString *)displayText; 31 | -(nullable id)valueData; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /XLForm/XL/NSObject+XLFormAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+XLFormAdditions.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRowDescriptor.h" 27 | 28 | #import "NSObject+XLFormAdditions.h" 29 | 30 | @implementation NSObject (XLFormAdditions) 31 | 32 | -(nullable NSString *)displayText 33 | { 34 | if ([self conformsToProtocol:@protocol(XLFormOptionObject)]){ 35 | return [(id)self formDisplayText]; 36 | } 37 | if ([self isKindOfClass:[NSString class]] || [self isKindOfClass:[NSNumber class]]){ 38 | return [self description]; 39 | } 40 | return nil; 41 | } 42 | 43 | -(nullable id)valueData 44 | { 45 | if ([self isKindOfClass:[NSString class]] || [self isKindOfClass:[NSNumber class]] || [self isKindOfClass:[NSDate class]]){ 46 | return self; 47 | } 48 | if ([self isKindOfClass:[NSArray class]]) { 49 | NSMutableArray * result = [NSMutableArray array]; 50 | [(NSArray *)self enumerateObjectsUsingBlock:^(id obj, NSUInteger __unused idx, BOOL __unused *stop) { 51 | [result addObject:[obj valueData]]; 52 | }]; 53 | return result; 54 | } 55 | if ([self conformsToProtocol:@protocol(XLFormOptionObject)]){ 56 | return [(id)self formValue]; 57 | } 58 | return nil; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /XLForm/XL/NSPredicate+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSPredicate+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface NSPredicate (XLFormAdditions) 29 | 30 | -(nonnull NSMutableArray*) getPredicateVars; 31 | @end 32 | -------------------------------------------------------------------------------- /XLForm/XL/NSPredicate+XLFormAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSPredicate+XLFormAdditions.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | #import "NSPredicate+XLFormAdditions.h" 26 | #import "NSExpression+XLFormAdditions.h" 27 | 28 | @implementation NSPredicate (XLFormAdditions) 29 | 30 | 31 | -(nonnull NSMutableArray*) getPredicateVars{ 32 | NSMutableArray* ret = [[NSMutableArray alloc] init]; 33 | if ([self isKindOfClass:([NSCompoundPredicate class])]) { 34 | for (id object in ((NSCompoundPredicate*) self).subpredicates ) { 35 | [ret addObjectsFromArray:[object getPredicateVars]]; 36 | } 37 | } 38 | else if ([self isKindOfClass:([NSComparisonPredicate class])]){ 39 | [ret addObjectsFromArray:[((NSComparisonPredicate*) self).leftExpression getExpressionVars]]; 40 | [ret addObjectsFromArray:[((NSComparisonPredicate*) self).rightExpression getExpressionVars]]; 41 | } 42 | return ret; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /XLForm/XL/NSString+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | #import "XLFormDescriptor.h" 28 | 29 | @interface NSString (XLFormAdditions) 30 | 31 | -(nonnull NSPredicate *)formPredicate; 32 | 33 | -(nonnull NSString *)formKeyForPredicateType:(XLPredicateType)predicateType; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XLForm/XL/UIView+XLFormAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+XLFormAdditions.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormDescriptorCell.h" 27 | #import 28 | 29 | @interface UIView (XLFormAdditions) 30 | 31 | +(nonnull instancetype)autolayoutView; 32 | -(nonnull NSLayoutConstraint *)layoutConstraintSameHeightOf:(nonnull UIView *)view; 33 | -(nullable UIView *)findFirstResponder; 34 | -(nullable UITableViewCell *)formDescriptorCell; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormBaseCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormBaseCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormDescriptorCell.h" 27 | #import "XLFormViewController.h" 28 | #import 29 | 30 | @class XLFormViewController; 31 | @class XLFormRowDescriptor; 32 | 33 | 34 | @interface XLFormBaseCell : UITableViewCell 35 | 36 | @property (nonatomic, weak) XLFormRowDescriptor * rowDescriptor; 37 | 38 | -(XLFormViewController *)formViewController; 39 | 40 | @end 41 | 42 | 43 | @protocol XLFormReturnKeyProtocol 44 | 45 | @property (nonatomic, assign) UIReturnKeyType returnKeyType; 46 | @property (nonatomic, assign) UIReturnKeyType nextReturnKeyType; 47 | 48 | @end 49 | 50 | 51 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormButtonCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormButtonCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | #import 28 | 29 | @interface XLFormButtonCell : XLFormBaseCell 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormCheckCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormCheckCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormCheckCell : XLFormBaseCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormCheckCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormCheckCell.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormCheckCell.h" 27 | 28 | @implementation XLFormCheckCell 29 | 30 | #pragma mark - XLFormDescriptorCell 31 | 32 | - (void)configure 33 | { 34 | [super configure]; 35 | self.accessoryType = UITableViewCellAccessoryCheckmark; 36 | self.editingAccessoryType = self.accessoryType; 37 | } 38 | 39 | - (void)update 40 | { 41 | [super update]; 42 | self.textLabel.text = self.rowDescriptor.title; 43 | self.accessoryType = [self.rowDescriptor.value boolValue] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; 44 | self.editingAccessoryType = self.accessoryType; 45 | CGFloat red, green, blue, alpha; 46 | [self.tintColor getRed:&red green:&green blue:&blue alpha:&alpha]; 47 | self.selectionStyle = UITableViewCellSelectionStyleDefault; 48 | if (self.rowDescriptor.isDisabled){ 49 | [self setTintColor:[UIColor colorWithRed:red green:green blue:blue alpha:0.3]]; 50 | self.selectionStyle = UITableViewCellSelectionStyleNone; 51 | } 52 | else{ 53 | [self setTintColor:[UIColor colorWithRed:red green:green blue:blue alpha:1]]; 54 | } 55 | } 56 | // 57 | 58 | -(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller 59 | { 60 | self.rowDescriptor.value = [NSNumber numberWithBool:![self.rowDescriptor.value boolValue]]; 61 | [self.formViewController updateFormRow:self.rowDescriptor]; 62 | [controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES]; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormDateCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormDateCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | typedef NS_ENUM(NSUInteger, XLFormDateDatePickerMode) { 29 | XLFormDateDatePickerModeGetFromRowDescriptor, 30 | XLFormDateDatePickerModeDate, 31 | XLFormDateDatePickerModeDateTime, 32 | XLFormDateDatePickerModeTime 33 | }; 34 | 35 | typedef NS_ENUM(NSUInteger, XLFormDateDatePickerStyle) { 36 | XLFormDateDatePickerStyleAutomatic, 37 | XLFormDateDatePickerStyleCompact, 38 | XLFormDateDatePickerStyleInline, 39 | XLFormDateDatePickerStyleWheels 40 | }; 41 | 42 | @interface XLFormDateCell : XLFormBaseCell 43 | 44 | @property (nonatomic, assign) XLFormDateDatePickerMode formDatePickerMode; 45 | @property (nonatomic, assign) XLFormDateDatePickerStyle formDatePickerStyle; 46 | @property (nonatomic, copy ) NSDate *minimumDate; 47 | @property (nonatomic, copy ) NSDate *maximumDate; 48 | @property (nonatomic, assign) NSInteger minuteInterval; 49 | @property (nonatomic, copy ) NSLocale *locale; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormDatePickerCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormDatePickerCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormBaseCell.h" 28 | 29 | #import 30 | 31 | @interface XLFormDatePickerCell : XLFormBaseCell 32 | 33 | @property (nonatomic, readonly) UIDatePicker * datePicker; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormDescriptorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormDescriptorCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | 29 | @class XLFormRowDescriptor; 30 | @class XLFormViewController; 31 | 32 | @protocol XLFormDescriptorCell 33 | 34 | @required 35 | 36 | @property (nonatomic, weak) XLFormRowDescriptor * rowDescriptor; 37 | -(void)configure; 38 | -(void)update; 39 | 40 | @optional 41 | 42 | +(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor; 43 | -(BOOL)formDescriptorCellCanBecomeFirstResponder; 44 | -(BOOL)formDescriptorCellBecomeFirstResponder; 45 | -(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller; 46 | -(NSString *)formDescriptorHttpParameterName; 47 | 48 | 49 | -(void)highlight; 50 | -(void)unhighlight; 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormDescriptorDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormDescriptorDelegate.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormDescriptor.h" 27 | #import 28 | 29 | @class XLFormSectionDescriptor; 30 | 31 | typedef NS_ENUM(NSUInteger, XLPredicateType) { 32 | XLPredicateTypeDisabled = 0, 33 | XLPredicateTypeHidden 34 | }; 35 | 36 | 37 | @protocol XLFormDescriptorDelegate 38 | 39 | @required 40 | 41 | -(void)formSectionHasBeenRemoved:(XLFormSectionDescriptor *)formSection atIndex:(NSUInteger)index; 42 | -(void)formSectionHasBeenAdded:(XLFormSectionDescriptor *)formSection atIndex:(NSUInteger)index; 43 | -(void)formRowHasBeenAdded:(XLFormRowDescriptor *)formRow atIndexPath:(NSIndexPath *)indexPath; 44 | -(void)formRowHasBeenRemoved:(XLFormRowDescriptor *)formRow atIndexPath:(NSIndexPath *)indexPath; 45 | -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue; 46 | -(void)formRowDescriptorPredicateHasChanged:(XLFormRowDescriptor *)formRow 47 | oldValue:(id)oldValue 48 | newValue:(id)newValue 49 | predicateType:(XLPredicateType)predicateType; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormImageCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormBaseCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormImageCell : XLFormBaseCell 29 | 30 | @end 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormInlineRowDescriptorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormInlineRowDescriptorCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @protocol XLFormInlineRowDescriptorCell 29 | 30 | @property (nonatomic, weak) XLFormRowDescriptor * inlineRowDescriptor; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormInlineSelectorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormInlineSelectorCell.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormInlineSelectorCell : XLFormBaseCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormLeftRightSelectorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormLeftRightSelectorCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import 28 | 29 | 30 | @interface XLFormLeftRightSelectorCell : XLFormBaseCell 31 | 32 | @property (nonatomic, readonly) UIButton * leftButton; 33 | @property (nonatomic, readonly) UILabel * rightLabel; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormOptionsObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormOptionsObject.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRowDescriptor.h" 27 | #import 28 | 29 | @interface XLFormOptionsObject : NSObject 30 | 31 | @property (nonatomic, copy) NSString * formDisplaytext; 32 | @property (nonatomic, strong) id formValue; 33 | 34 | +(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText; 35 | +(XLFormOptionsObject *)formOptionsOptionForValue:(id)value fromOptions:(NSArray *)options; 36 | +(XLFormOptionsObject *)formOptionsOptionForDisplayText:(NSString *)displayText fromOptions:(NSArray *)options; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormOptionsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormOptionsViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | 28 | #import "XLFormRowDescriptorViewController.h" 29 | #import "XLFormRowDescriptor.h" 30 | 31 | @interface XLFormOptionsViewController : UITableViewController 32 | 33 | - (instancetype)initWithStyle:(UITableViewStyle)style; 34 | 35 | 36 | - (instancetype)initWithStyle:(UITableViewStyle)style 37 | titleHeaderSection:(NSString *)titleHeaderSection 38 | titleFooterSection:(NSString *)titleFooterSection; 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormPickerCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormPickerCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | #import "XLFormBaseCell.h" 28 | 29 | @interface XLFormPickerCell : XLFormBaseCell 30 | 31 | @property (nonatomic, weak) UIPickerView * pickerView; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRegexValidator.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRegexValidator.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormValidatorProtocol.h" 27 | #import "XLFormValidationStatus.h" 28 | #import "XLFormValidator.h" 29 | 30 | @interface XLFormRegexValidator : XLFormValidator 31 | 32 | @property (nonatomic, copy) NSString *msg; 33 | @property (nonatomic, copy) NSString *regex; 34 | 35 | - (instancetype)initWithMsg:(NSString*)msg andRegexString:(NSString*)regex; 36 | + (XLFormRegexValidator *)formRegexValidatorWithMsg:(NSString *)msg regex:(NSString *)regex; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRegexValidator.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRegexValidator.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRegexValidator.h" 27 | 28 | @implementation XLFormRegexValidator 29 | 30 | -(instancetype)initWithMsg:(NSString*)msg andRegexString:(NSString*)regex { 31 | self = [super init]; 32 | if (self) { 33 | self.msg = msg; 34 | self.regex = regex; 35 | } 36 | 37 | return self; 38 | } 39 | 40 | -(XLFormValidationStatus *)isValid: (XLFormRowDescriptor *)row { 41 | if (row != nil && row.value != nil) { 42 | // we only validate if there is a value 43 | // assumption: required validation is already triggered 44 | // if this field is optional, we only validate if there is a value 45 | id value = row.value; 46 | if ([value isKindOfClass:[NSNumber class]]){ 47 | value = [value stringValue]; 48 | } 49 | if ([value isKindOfClass:[NSString class]] && [value length] > 0) { 50 | BOOL isValid = [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", self.regex] evaluateWithObject:[value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]]; 51 | return [XLFormValidationStatus formValidationStatusWithMsg:self.msg status:isValid rowDescriptor:row]; 52 | } 53 | } 54 | return nil; 55 | }; 56 | 57 | +(XLFormRegexValidator *)formRegexValidatorWithMsg:(NSString *)msg regex:(NSString *)regex { 58 | return [[XLFormRegexValidator alloc] initWithMsg:msg andRegexString:regex]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRightDetailCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRightDetailCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface XLFormRightDetailCell : UITableViewCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRightDetailCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRightDetailCell.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRightDetailCell.h" 27 | 28 | @implementation XLFormRightDetailCell 29 | 30 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 31 | { 32 | return [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseIdentifier]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRightImageButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRightImageButton.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface XLFormRightImageButton : UIButton 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRightImageButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRightImageButton.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRightImageButton.h" 27 | 28 | @implementation XLFormRightImageButton 29 | 30 | 31 | - (CGSize)intrinsicContentSize 32 | { 33 | CGSize s = [super intrinsicContentSize]; 34 | return CGSizeMake(s.width + self.titleEdgeInsets.left + self.titleEdgeInsets.right, 35 | s.height + self.titleEdgeInsets.top + self.titleEdgeInsets.bottom); 36 | 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRowDescriptorViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRowDescriptorViewController.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "XLFormRowDescriptor.h" 28 | #import 29 | 30 | @protocol XLFormRowDescriptorViewController 31 | 32 | @required 33 | @property (nonatomic, weak) XLFormRowDescriptor * rowDescriptor; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormRowNavigationAccessoryView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormRowNavigationAccessoryView.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | @interface XLFormRowNavigationAccessoryView : UIToolbar 29 | 30 | @property (nonatomic, weak) UIBarButtonItem *previousButton; 31 | @property (nonatomic, weak) UIBarButtonItem *nextButton; 32 | @property (nonatomic, weak) UIBarButtonItem *doneButton; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormSegmentedCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormSegmentedCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormSegmentedCell : XLFormBaseCell 29 | 30 | @property (nonatomic, readonly) UILabel * textLabel; 31 | @property (nonatomic, readonly) UISegmentedControl *segmentedControl; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormSelectorCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormSelectorCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | #import 28 | 29 | @interface XLFormSelectorCell : XLFormBaseCell 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormSliderCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormSliderCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLForm.h" 27 | 28 | @interface XLFormSliderCell : XLFormBaseCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormStepCounterCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormStepCounterCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | #import 28 | 29 | @interface XLFormStepCounterCell : XLFormBaseCell 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormSwitchCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormSwitchCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | 28 | @interface XLFormSwitchCell : XLFormBaseCell 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormSwitchCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormSwitchCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRowDescriptor.h" 27 | 28 | #import "XLFormSwitchCell.h" 29 | 30 | @implementation XLFormSwitchCell 31 | 32 | #pragma mark - XLFormDescriptorCell 33 | 34 | - (void)configure 35 | { 36 | [super configure]; 37 | self.selectionStyle = UITableViewCellSelectionStyleNone; 38 | self.accessoryView = [[UISwitch alloc] init]; 39 | self.editingAccessoryView = self.accessoryView; 40 | [self.switchControl addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged]; 41 | } 42 | 43 | - (void)update 44 | { 45 | [super update]; 46 | self.textLabel.text = self.rowDescriptor.title; 47 | self.switchControl.on = [self.rowDescriptor.value boolValue]; 48 | self.switchControl.enabled = !self.rowDescriptor.isDisabled; 49 | } 50 | 51 | - (UISwitch *)switchControl 52 | { 53 | return (UISwitch *)self.accessoryView; 54 | } 55 | 56 | - (void)valueChanged 57 | { 58 | self.rowDescriptor.value = @(self.switchControl.on); 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormTextFieldCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormTextFieldCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormBaseCell.h" 27 | #import 28 | 29 | extern NSString *const XLFormTextFieldLengthPercentage; 30 | extern NSString *const XLFormTextFieldMaxNumberOfCharacters; 31 | 32 | @interface XLFormTextFieldCell : XLFormBaseCell 33 | 34 | @property (nonatomic, readonly, weak) UILabel * textLabel; 35 | @property (nonatomic, readonly, weak) UITextField * textField; 36 | 37 | @property (nonatomic, copy) NSNumber *textFieldLengthPercentage; 38 | @property (nonatomic, copy) NSNumber *textFieldMaxNumberOfCharacters; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormTextView.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | 29 | @interface XLFormTextView : UITextView 30 | 31 | 32 | @property (nonatomic, copy) NSString *placeholder; 33 | @property (nonatomic, copy) UIColor *placeholderColor; 34 | 35 | @property (nonatomic, readonly, weak) UILabel *placeHolderLabel; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormTextViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormTextViewCell.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormTextView.h" 27 | #import "XLFormBaseCell.h" 28 | #import 29 | 30 | extern NSString *const XLFormTextViewLengthPercentage; 31 | extern NSString *const XLFormTextViewMaxNumberOfCharacters; 32 | 33 | @interface XLFormTextViewCell : XLFormBaseCell 34 | 35 | @property (nonatomic, readonly) UILabel * label DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use textLabel instead"); 36 | @property (nonatomic, readonly, weak) UILabel * textLabel; 37 | @property (nonatomic, readonly, weak) XLFormTextView * textView; 38 | 39 | @property (nonatomic, copy) NSNumber *textViewLengthPercentage; 40 | @property (nonatomic, copy) NSNumber *textViewMaxNumberOfCharacters; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormValidationStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidationStatus.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | #import "XLFormRowDescriptor.h" 29 | 30 | @interface XLFormValidationStatus : NSObject 31 | 32 | @property (nonatomic, copy) NSString *msg; 33 | @property (nonatomic, assign) BOOL isValid; 34 | @property (nonatomic, weak) XLFormRowDescriptor *rowDescriptor; 35 | 36 | //-(instancetype)initWithMsg:(NSString*)msg andStatus:(BOOL)isValid; 37 | -(instancetype)initWithMsg:(NSString*)msg status:(BOOL)isValid rowDescriptor:(XLFormRowDescriptor *)row; 38 | 39 | //+(XLFormValidationStatus *)formValidationStatusWithMsg:(NSString *)msg status:(BOOL)status; 40 | +(XLFormValidationStatus *)formValidationStatusWithMsg:(NSString *)msg status:(BOOL)status rowDescriptor:(XLFormRowDescriptor *)row; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormValidationStatus.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidationStatus.m 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormValidationStatus.h" 27 | 28 | @implementation XLFormValidationStatus 29 | 30 | -(instancetype)initWithMsg:(NSString*)msg andStatus:(BOOL)isValid { 31 | return [self initWithMsg:msg status:isValid rowDescriptor:nil]; 32 | } 33 | 34 | -(instancetype)initWithMsg:(NSString*)msg status:(BOOL)isValid rowDescriptor:(XLFormRowDescriptor *)row { 35 | self = [super init]; 36 | if (self) { 37 | self.msg = msg; 38 | self.isValid = isValid; 39 | self.rowDescriptor = row; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | +(XLFormValidationStatus *)formValidationStatusWithMsg:(NSString *)msg status:(BOOL)status { 46 | return [self formValidationStatusWithMsg:msg status:status rowDescriptor:nil]; 47 | } 48 | 49 | +(XLFormValidationStatus *)formValidationStatusWithMsg:(NSString *)msg status:(BOOL)status rowDescriptor:(XLFormRowDescriptor *)row { 50 | return [[XLFormValidationStatus alloc] initWithMsg:msg status:status rowDescriptor:row]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormValidator.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidator.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "XLFormValidatorProtocol.h" 28 | 29 | @interface XLFormValidator : NSObject 30 | 31 | +(XLFormValidator *)emailValidator; 32 | +(XLFormValidator *)emailValidatorLong; 33 | @end 34 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormValidator.m: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidator.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormValidationStatus.h" 27 | #import "XLFormRegexValidator.h" 28 | 29 | #import "XLFormValidator.h" 30 | 31 | @implementation XLFormValidator 32 | 33 | -(XLFormValidationStatus *)isValid:(XLFormRowDescriptor *)row 34 | { 35 | return [XLFormValidationStatus formValidationStatusWithMsg:nil status:YES rowDescriptor:row]; 36 | } 37 | 38 | #pragma mark - Validators 39 | 40 | 41 | +(XLFormValidator *)emailValidator 42 | { 43 | return [XLFormRegexValidator formRegexValidatorWithMsg:NSLocalizedString(@"Invalid email address", nil) regex:@"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"]; 44 | } 45 | +(XLFormValidator *)emailValidatorLong 46 | { 47 | return [XLFormRegexValidator formRegexValidatorWithMsg:NSLocalizedString(@"Invalid email address", nil) regex:@"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,11}"]; 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /XLForm/XL/XLFormValidatorProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // XLFormValidatorProtocol.h 3 | // XLForm ( https://github.com/xmartlabs/XLForm ) 4 | // 5 | // Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com ) 6 | // 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "XLFormRowDescriptor.h" 27 | 28 | @class XLFormValidationStatus; 29 | 30 | @protocol XLFormValidatorProtocol 31 | 32 | @required 33 | 34 | -(XLFormValidationStatus *)isValid:(XLFormRowDescriptor *)row; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /XLForm/XLForm.bundle/forwardarrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xmartlabs/XLForm/ceca40bb06c776758cc44e62df491ae9db7491f3/XLForm/XLForm.bundle/forwardarrow@2x.png --------------------------------------------------------------------------------