135 Commits

Author SHA1 Message Date
Mathias Claassen e9de49db86 formValuesIncludingHidden returns all values of a form including the values of hidden rows 2017-05-18 11:56:26 -03:00
MiMo42 77db6b9492 nullability warning fixed (#952) 2017-04-26 10:21:35 -03:00
Mathias Claassen 74b26c1e64 make properties of XLFormOptionsObject writable (#955) 2017-04-25 11:55:54 -03:00
Mathias Claassen 085cf31e52 Updated Readme Eureka introduction (#954) 2017-04-25 10:48:47 -03:00
FatalDizz 313e5d5d40 Added method to set a title for form errors (#951) 2017-04-19 11:46:34 -03:00
Mathias Claassen f7777d9d27 Add Header and Footer section to Readme FAQ (#942) 2017-04-05 09:46:52 -03:00
Mathias Claassen 578dea99dd Use the correct locale in date row (not only date picker) (#935) 2017-04-05 09:23:41 -03:00
Santiago Castro 1da30107dc Fix README headings due to GitHub change (#937)
GitHub changed its Markdown processor to stop supporting heading without spaces https://gist.github.com/vmarkovtsev/59cd7349d41cf804b9a8775388e681f8
2017-03-21 09:18:22 -03:00
Mathias Claassen 4674c3abaf Make moveRowAtIndexPath:toIndexPath: public in XLFormSectionDescriptor to allow to reorder rows programmatically. (#929) 2017-02-22 12:58:47 -03:00
Felix Dumit 5ca54fd949 Fix use of formatter in Info Cells (#916)
Adds example with infocell and bytecount formatter
2017-01-16 18:15:42 -03:00
Mathias Claassen e64e5b4885 update Travis file to use Xcode 8.2 (#920) 2017-01-12 10:24:37 -03:00
Mathias Claassen b28c902d73 release version 3.3.0 2016-11-17 11:10:10 -03:00
Mathias Claassen dc5f1e6dcd Merge pull request #895 from dvkch/master
Fix for #884
2016-11-03 11:33:16 -03:00
Stanislas Chevallier 55e440bc57 Fix: #884 by setting the UIDatePicker timeZone to GMT+0 when in countdown mode 2016-11-02 13:42:51 +01:00
Martin Barreto be2fb864be Update README.md 2016-10-21 18:14:17 -03:00
Mathias Claassen cdd498ebc7 Merge pull request #866 from xmartlabs/Swift3
Update Swift example to Swift 3 syntax
2016-10-20 14:46:21 -03:00
Mathias Claassen cd43abc3f0 Merge pull request #882 from kiancheong/OptionsRow-Deselect
OptionsRow-Deselect
2016-10-18 16:06:49 -03:00
kiancheong f1a83512d1 Prevents setting cell's accessoryType to UITableViewCellAccessoryNone if the rowDescriptor's required value is true.
This fixes the ability to deselect options when using XLFormRowDescriptorTypeSelectorPush.
2016-10-14 09:08:25 +08:00
Mathias Claassen 00ccf60895 Merge pull request #883 from kiancheong/bigsprocket-styling
bigsprocket-styling
2016-10-13 10:57:39 -03:00
kiancheong 27a172eb65 Synthesize cellConfigForSelector. 2016-10-11 19:31:45 +08:00
Kyle Davis e62404d24b remove unnecessary nil check 2016-10-11 12:57:16 +08:00
Kyle Davis d1aff91e63 Support styling of XLFormOptionViewController cells 2016-10-11 12:57:14 +08:00
Mathias Claassen a0a8cf793c Update Swift example to Swift 3 syntax 2016-09-15 13:33:38 -03:00
Mathias Claassen bb81e88572 Merge pull request #864 from choefele/master
Limit number of characters in XLFormTextFieldCell and XLFormTextViewCell
2016-09-07 10:31:50 -03:00
Claus Höfele 64ab7ccac0 Add property in XLFormTextViewCell to limit number of characters 2016-09-05 20:37:57 +02:00
Claus Höfele 9baeda1b0d Add property in XLFormTextFieldCell to limit number of characters
Implements #855
2016-09-05 18:52:23 +02:00
Mathias Claassen 6879f01230 Merge pull request #832 from xmartlabs/fix/constant
change XLFormUnspecifiedHeight constant to not collide with Automatic…
2016-07-22 11:34:30 -03:00
Mathias Claassen 50e9efe783 change XLFormUnspecifiedHeight constant to not collide with Automatic dimension 2016-07-22 11:34:01 -03:00
Mathias Claassen bf819ba0ed Merge pull request #831 from ablexie/master
Add locale property to date cell for inline cells
2016-07-22 11:26:50 -03:00
ablexie 087bbf089c datePicker.locale property public to developer,for example,
_birthdayRow = [XLFormRowDescriptor formRowDescriptorWithTag:kBirthdayTag rowType:XLFormRowDescriptorTypeDateInline title:@"Birthday"];
[_birthdayRow.cellConfig setObject:[[NSLocale alloc] initWithLocaleIdentifier:@"en"] forKey:@"locale"];
2016-07-21 10:29:17 +08:00
Mathias Claassen eac2f816d7 Merge pull request #819 from 3a4oT/master
Refactored '-(id)init..' to '- (instancetype)init...'
2016-07-07 11:23:43 -03:00
Mathias Claassen b19bf9bafc Merge pull request #817 from 3a4oT/patch-2
Update 'initializeForm' example.
2016-07-07 11:18:00 -03:00
Petro Rovenskyy ce869235bc Refactored '-(id)init' to '- (instancetype)init' 2016-07-04 21:50:17 +03:00
Petro Rovenskyy bb93c90c2d Update 'initializeForm' example.
Copy and paste the example of  ```initializeForm``` and feel the power of XLForm immediately. =)
2016-07-01 15:47:22 +03:00
Mathias Claassen 7b50e19cf6 Merge pull request #814 from 3a4oT/patch-1
Update pod badge
2016-06-30 10:12:56 -03:00
Petro Rovenskyy 8eefa8afd9 Update pod badge 2016-06-30 15:27:48 +03:00
Mathias Claassen ca53315145 Merge pull request #810 from jeanmartin/master
[fixes #452] respect the currentLocale when parsing decimal values
2016-06-28 09:44:14 -03:00
Jan Schwenzien c3263f7645 [fixes #452] respect the currentLocale when parsing decimal values 2016-06-27 22:04:51 +02:00
Mathias Claassen fbf800fc21 Merge pull request #806 from jimmyti/master
Fixed selector action sheet to use the row's value transformer
2016-06-24 09:54:33 -03:00
Jimmy Ti fbc08a7094 Remove the fix for suppressing "Empty snapshot" warnings when presenting action sheets 2016-06-23 23:10:57 +10:00
Jimmy Ti f1f8a21bf0 Updated code to actually use the optionTitle variable 2016-06-21 00:18:33 +10:00
Jimmy Ti 694c08beee Fixed selector action sheet to use the row's value transformer 2016-06-20 21:19:20 +10:00
Mathias Claassen c7d5708f16 update pod version 2016-06-16 10:34:54 -03:00
Mathias Claassen dd294cc709 Merge pull request #804 from xmartlabs/fix/multiEmpty
added count to empty check. Helpful to validate multiple selectors be…
2016-06-13 17:24:08 -03:00
Mathias Claassen cda0327def added count to empty check. Helpful to validate multiple selectors being empty 2016-06-13 17:23:44 -03:00
Mathias Claassen 9a2bdf1ca0 Merge pull request #797 from xmartlabs/fix/decimals
Fix decimal number formatting. closes #514
2016-06-02 13:46:49 -03:00
Mathias Claassen d8b67b5c21 Fix decimal number formatting. closes #514 2016-06-02 13:46:25 -03:00
Mathias Claassen f30fa9bb31 Merge pull request #796 from xmartlabs/feature/cellHeight
Added height property to XLFormRowDescriptor
2016-06-02 12:52:47 -03:00
Mathias Claassen 9b1e7d6d4e Added height property to XLFormRowDescriptor 2016-06-02 12:41:12 -03:00
Mathias Claassen fac9cefc2b Merge pull request #652 from droidlabs/custom-multiselect
Row with multiple selector should support custom controller
2016-06-02 11:14:23 -03:00
Mathias Claassen d202a40824 Merge pull request #794 from xmartlabs/readmeUpdate
updated readme with some comments. Fixes #771, fixes #727, fixes #696
2016-06-01 15:16:15 -03:00
Mathias Claassen d185e642e0 updated readme with some comments. Fixes #771, fixes #727, fixes #696 2016-06-01 15:15:35 -03:00
Mathias Claassen 743c5d289a Merge pull request #695 from realestate-com-au/hotfix/code-sign
Changed Release config to use iPhone Distribution code sign identity
2016-06-01 14:20:54 -03:00
Mathias Claassen de86c5e60e Merge pull request #306 from ziogaschr/add-support-NSFormatter
Add support for NSFormatter.
 closes #77 , closes #195 , closes #176 closes #64
2016-05-31 12:15:00 -03:00
Chris Ziogas f52c532fec Add support for NSFormatter 2016-05-31 17:57:18 +03:00
Mathias Claassen 274892dc95 Merge pull request #792 from xmartlabs/fix/validation
Do validation can be nullable. fixes #705
2016-05-31 11:54:29 -03:00
Mathias Claassen 09b28286de Do validation can be nullable. fixes #705 2016-05-31 11:54:06 -03:00
Mathias Claassen bbca57a2e6 Merge pull request #456 from conradwt/master
Update project README
2016-05-31 11:34:35 -03:00
Mathias Claassen d29275b780 Merge pull request #523 from MuscleRumble/appextensions
Fixed #357 by adding XL_APP_EXTENSIONS macro so that XLForm can be used in App Extensions
2016-05-31 11:30:01 -03:00
Mathias Claassen 11f54cee17 Merge pull request #686 from alejandrogarin/numberFormatter
Controlling formatting output when the rowType is XLFormRowDescriptorTypeNumber or XLFormRowDescriptorTypeDecimal
2016-05-31 11:16:24 -03:00
Mathias Claassen 418b3e4c96 Merge pull request #782 from kiancheong/UITextView-ShouldChange-Delegate
Added shouldChangeTextInRange delegate call for UITextView.
2016-05-31 11:03:13 -03:00
Mathias Claassen 6da2fc456c Merge pull request #791 from xmartlabs/fix/value2CellStyle
fix crash when using cell style Value2. closes #770
2016-05-30 17:25:09 -03:00
Mathias Claassen 52be3f3531 fix crash when using cell style Value2. closes #770 2016-05-30 17:14:13 -03:00
Mathias Claassen 5e00deb474 Merge pull request #790 from xmartlabs/fix/textFieldPercentage
Fix when the textFieldPercentage is applied. Closes #776
2016-05-30 16:46:37 -03:00
Mathias Claassen 2a8ebf2af5 Fix when the textFieldPercentage is applied. Closes #776 2016-05-30 16:46:09 -03:00
Mathias Claassen 5c716a665d Merge pull request #789 from mbjacks/master
fix crash when adding a validator to a copied row descriptor
2016-05-30 16:21:51 -03:00
Matt Jackson 60e67b9651 fix crash when adding a validator to a copied row descriptor 2016-05-27 14:20:56 -07:00
Mathias Claassen 6aac513398 Merge pull request #753 from jpmhouston/example-podfile
updated example podfile for cocoapods 1.0 compatibility
2016-05-24 16:58:11 -03:00
Mathias Claassen 0491752090 update pod spec for new release 2016-05-24 16:56:15 -03:00
Mathias Claassen c32e28f753 Merge pull request #785 from xmartlabs/fix/buttonDisabled
fix button cell disabled state.
2016-05-24 16:45:37 -03:00
Mathias Claassen 2b55aeac74 Merge pull request #786 from xmartlabs/fix/updateRow
Update row in `cellForRowAtIndexPath` instead of `willDisplayCell`.
2016-05-24 16:37:25 -03:00
Mathias Claassen 94959f9da8 Merge pull request #788 from xmartlabs/fix/TestPods
fixed tests pod spec
2016-05-24 16:23:36 -03:00
Mathias Claassen 25798bb123 fixed tests pod spec 2016-05-24 16:23:15 -03:00
Mathias Claassen d6d14140cf Update row in cellForRowAtIndexPath instead of willDisplayCell.
Add Changelog
2016-05-23 13:09:54 -03:00
Mathias Claassen c036d7a06b fix button cell disabled state. closes #780 2016-05-23 12:40:07 -03:00
kiancheong 51760a535a Added shouldChangeTextInRange delegate call for UITextView. 2016-05-11 11:13:17 +08:00
Mathias Claassen 542191ba69 Merge pull request #779 from xmartlabs/fix/designatedInitializers
fixed designated initialiser setting back to nib name and coder
2016-05-06 09:31:42 -03:00
Mathias Claassen c1b64f7828 fixed designated initialiser setting back to nib name and coder 2016-05-06 09:31:01 -03:00
Mathias Claassen 8009dd8cb7 Merge pull request #775 from SiarheiFedartsou/master
XLFormLeftRightSelectorOption left value change policy
2016-05-05 18:04:41 -03:00
Mathias Claassen 8d65cbe361 Merge pull request #777 from xmartlabs/fix/defaultKeyboardtype
Removed the setting of default keyboard type in text and name row.
2016-05-05 13:49:16 -03:00
Mathias Claassen 79eb596143 Removed the setting of default keyboard type in text and name row. 2016-05-05 11:37:44 -03:00
Mathias Claassen 0e866a0f22 Merge pull request #773 from koenpunt/patch-1
Add cancel action to image selector
2016-05-04 10:28:12 -03:00
Mathias Claassen d68166c669 Merge pull request #774 from hirad/swift-friendly-inits
Swift-friendly init methods
2016-05-04 10:25:35 -03:00
Siarhei Fiedartsou 72115e32ea iOS 7 fix 2016-04-29 17:13:05 +03:00
Siarhei Fiedartsou 5475ed7ed7 small fix in XLFormLeftRightSelectorOptionLeftValueChangePolicy enum 2016-04-29 16:54:56 +03:00
Siarhei Fiedartsou 8bdeb264c1 XLFormLeftRightSelectorOptionLeftValueChangePolicy added 2016-04-29 16:54:39 +03:00
Hirad Motamed 437c1e4d38 Current a XLFormViewController-subclass in Swift cannot have a custom init (it will crash at runtime with an 'unimplemented initializer' error). This fix adds designated initializer markings on the view controller and refactors them to all call the designated initializer. 2016-04-27 15:54:41 -07:00
Koen Punt 972815d7ea Add cancel action to image selector 2016-04-26 12:18:23 +02:00
Martin Barreto eeb165b1cc Merge pull request #759 from Drusy/master
Fix typo in README for Objective-C code
2016-04-06 12:37:38 -03:00
Kévin Renella 47dfa518c4 Fix typo in README for Objective-C code
The red color is [UIColor redColor]
2016-04-01 09:13:40 +02:00
Mathias Claassen bb9aceff75 Merge pull request #751 from bartvandendriessche/xlformdatecell_should_apply_cellconfiguration
XLFormDateCell applies cellConfiguration on value change
2016-03-29 09:59:24 -03:00
Pierre Houston 0d24f47f75 updated podfile for compatibility with cocoapods 1.0, did pod deintegrate on project to remove cruft
- fixes warnings on 'pod install': 'The dependency ... is not used in any concrete target'
2016-03-22 18:33:01 -07:00
Bart Vandendriessche 7ae1a5d612 XLFormDateCell applies cellConfiguration on value change
Previously, XLCFormDateCell would not invoke `updateFormRow` on its
`formViewController`.

This caused an issue where custom cell settings in `cellConfig` would
get overriden whenever the date changes.
2016-03-21 15:54:28 +01:00
Mathias Claassen 0db6e546c5 Merge pull request #735 from xmartlabs/fix/rowCopy
added validators copy to rowDescriptor copyWithZone.
2016-02-18 17:18:21 -03:00
Mathias Claassen 1229cb8d6a added validators copy to rowDescriptor copyWithZone.
Fixes #729
2016-02-18 17:17:56 -03:00
Mathias Claassen 4203e465f9 release version 3.1.1 2016-02-16 17:48:36 -03:00
Mathias Claassen 554893068d Merge pull request #733 from xmartlabs/fix/actionSheet
fixed crash when launching action sheet from iOS 9
2016-02-15 17:48:25 -03:00
Mathias Claassen b218344519 fixed crash when launching action sheet from iOS 9 2016-02-15 17:34:54 -03:00
Mathias Claassen 639235ec4d Merge pull request #732 from xmartlabs/fix/setRowDescriptor
Setting row descriptor will not fire cell config. This is done when u…
2016-02-15 17:32:34 -03:00
Mathias Claassen 94e3e57d48 Setting row descriptor will not fire cell config. This is done when updating the row. 2016-02-15 17:06:10 -03:00
Mathias Claassen 2eac764cad Merge pull request #707 from 27629678/master
fixed a crash
2016-02-15 16:25:41 -03:00
Mathias Claassen c85896cff2 Merge pull request #730 from ReadmeCritic/master
Correct the spelling of CocoaPods in README
2016-02-15 11:02:19 -03:00
ReadmeCritic bd5e239852 Correct the spelling of CocoaPods in README 2016-02-12 22:47:34 -08:00
Mathias Claassen baf470bf66 Merge pull request #692 from popina/master
Add an option to end editing the tableview on scroll
2016-02-12 10:16:43 -03:00
Mathias Claassen 4fd80c36f1 Merge pull request #701 from Vortec4800/pickerFix
Fixed normal and inline picker views to use row's value transformer
2016-02-12 10:13:13 -03:00
Mathias Claassen 1bffeb636f Merge pull request #694 from realestate-com-au/hotfix/deployment-target
Changed the minimum deployment target to 8.0
2016-02-09 10:18:30 -03:00
Mathias Claassen f6b1b4af75 Merge pull request #713 from xmartlabs/refactor
Removed Duplicated folder `Examples` under `Examples/Swift`
2016-01-27 12:07:56 -03:00
Mathias Claassen 001f63363c Removed Duplicated folder Examples under Examples/Swift
closes #698
2016-01-25 18:45:05 -03:00
yuxiaohua f379ee6ed9 fix bug: fixed UIViewController's instance, which does not inherit from XLFormViewController, using subclass of XLFormBaseCell will crash when its getFirstResponder method is invoked. 2016-01-25 17:47:20 +08:00
Tobias Hagemann 756fdb914b Merge branch 'master' of https://github.com/xmartlabs/XLForm into appextensions 2016-01-16 11:29:29 +01:00
Cory Imdieke 8b7507a690 Fixed normal and inline picker views to use row's value transformer for display text 2016-01-14 10:25:41 -06:00
Iskander Haziev 3df413b0fa Row with multiple selector should support custom controller 2016-01-05 17:18:40 +03:00
Stephen Yao 97b79f1f93 Changed Release config to distribution profile for code signing
(cherry picked from commit c4d7f7c9ef5a3a5d6799a8ff6e6a34872ea4b7bd)
2016-01-04 14:35:35 +11:00
Stephen Yao 763a2b12c0 Changed the minimum deployment target to 8.0 to support iOS 8 for developers installing the library through a git submodule 2016-01-04 14:02:25 +11:00
Martin Barreto 3d2b7a28f9 Merge pull request #687 from 27629678/master
fix no containsString: method in NSString under iOS8_0
2015-12-30 10:12:16 -03:00
yuxiaohua 3b0c113fe8 fix no containsString: method in NSString under iOS8_0 2015-12-29 09:44:12 +08:00
Martin Barreto f40357a193 Merge pull request #676 from xmartlabs/feature/customInlineRow
Added custom inline row example in Objective C and Swift.
2015-12-28 16:32:14 -03:00
Alejandro Garin ba949c3697 check if self conform to protocol XLFormOptionObject before checking if the object is kind of class NSString or NSNumber. This allow better control in the formatted output if the object is a NSNumber 2015-12-28 15:00:44 -03:00
Fonkymasto 5afb5e00a4 end editing on scroll is an option 2015-12-28 14:45:35 +01:00
Mathias Claassen 340683b106 Merge pull request #681 from realestate-com-au/master
Fix build error ‘XLFormImageCell.h’ file not found by moving XLFormImageCell from project header to public header
2015-12-22 09:59:39 -03:00
Jacky Li 6caa5b32f7 Fix build error ‘XLFormImageCell.h’ file not found by moving XLFormImageCell from project header to public header 2015-12-22 10:41:27 +11:00
Mathias Claassen 7865939994 Merge pull request #670 from loongman/master
Fix build error "‘XLFormImageCell.h’ file not found" by including XLF…
2015-12-21 16:40:10 -03:00
Mathias Claassen 7adfdb3219 Added custom inline row example in Objective C and Swift. 2015-12-17 18:15:04 -03:00
Mathias Claassen 9de9b69f04 Merge pull request #674 from xmartlabs/feature/textViewpercentage
allow setting the width percentage of an UITextView. Closes #534
2015-12-16 16:09:28 -03:00
Mathias Claassen 55176682d0 allow setting the width percentage of an UITextView. Closes #534 2015-12-15 12:58:49 -03:00
Mathias Claassen eaaba3247f Merge pull request #673 from xmartlabs/fix/readmeDelegates
update readme delegate section
2015-12-15 11:26:42 -03:00
Mathias Claassen 5a6c6bb33a update readme delegate section 2015-12-15 11:26:15 -03:00
Mathias Claassen 3a5ec757a5 Merge pull request #672 from xmartlabs/fix/predicateException
Try to remove the most exception when defining the hidden and disable…
2015-12-15 10:38:18 -03:00
Mathias Claassen 8fe5d15665 Merge pull request #671 from xmartlabs/fix/swiftExamples
order example groups alphabetically. Replace formSegueIdenfifiers in …
2015-12-15 10:38:03 -03:00
Mathias Claassen 9ed0e4be8d Try to remove the most exception when defining the hidden and disabled predicates. Will still throw an exception when defining forward dependencies 2015-12-15 10:16:51 -03:00
Mathias Claassen b13aa96ad7 order example groups alphabetically. Replace formSegueIdenfifiers in SwiftExample 2015-12-15 10:15:14 -03:00
loongman 0d97964006 Fix build error "‘XLFormImageCell.h’ file not found" by including XLFormImageCell into project file. 2015-12-15 11:43:23 +08:00
Tobias Hagemann e31c6db521 Merge branch 'master' of https://github.com/xmartlabs/XLForm into appextensions 2015-09-18 17:49:06 +02:00
Tobias Hagemann 15a4ce9d83 Fixed #357 by adding XL_APP_EXTENSIONS macro so that XLForm can be used in App Extensions 2015-08-25 16:41:56 +02:00
Conrad Taylor 5b136eb458 Enhance the copy for creating a form and add a section for Storyboard users. 2015-07-23 13:19:54 -07:00
134 changed files with 2606 additions and 6498 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.2
osx_image: xcode8.2
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
+137
View File
@@ -0,0 +1,137 @@
# Change Log
All notable changes to this project will be documented in this file.
### Version 3.3.0:
* Added `cellConfigForSelector` to style XLFormOptionsViewController
* Added properties to **limit number of characters** in `XLFormTextFieldCell` and `XLFormTextViewCell`
* Minor fixes
### Version 3.2.0:
* Added XL_APP_EXTENSIONS macro to allow app extensions (@MuscleRumble #357)
* Added shouldChangeTextInRange delegate call for UITextView. (@kiancheong #782)
* Added support for NSFormatter (@ziogaschr, @fwhenin, @bhirt-bpl #306)
* Added `height` property to XLFormRowDescriptor to allow setting height of individual cells.
### Version 3.1.2:
* Update row in `cellForRowAtIndexPath` instead of `willDisplayCell`
* Added cancel action to image selector (by koenpunt)
* Other minor fixes
### Version 3.1.1
* Allow setting width percentage on UITextView
* Added custom inline row example
* Fixed bug where XLFormImageCell was not added to project
* Add ability to `end editing` on scroll
* Other bugs and refactor
### Version 3.1.0
* Added Carthage support
* Added NSCoding protocol
* Allowed HTTP connections
* Several bugfixes and improvements.
### Version 3.0.2
* Fix issue when inline pickers expand beyond table.
### Version 3.0.1
* Improvements and bug fixes.
* Ability to left, right align textfields. Ability to set up a minimum textField width.
* If form is being shown, assigning a new form automatically reload the tableview.
* Update objective-c and swift example projects.
* Swift compatibility fixes.
* Long email validation added.
* Fixed row copy issue, now valueTransformer value is copied.
* Fixed step counter row layout issues.
* Fixed issue "Last form field hides beneath enabled navigation controller's toolbar".
* Fixed issue "Navigating between cells using bottom navigation buttons causes table cell dividers to disappear".
* Use UIAlertController instead UIActionSheet/UIAlertView if possible.
* Hidden and disabled rows resign first responder before changing state.
* onChangeBlock added to rowDescriptor.
* use tintColor as default button row color.
* By default accessoryView is no longer shown for inline rows.
* Fix NSBundle issues to use XLForm as dynamic framework.
### Version 3.0.0
* `hidden`, `disable` properties added to `XLFormRowDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide, disable de row.
* `hidden` property added to `XLFormSectionDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide the section.
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
### Version 2.2.0
* Fixed "(null)" caption when `XLFormRowDescriptorTypeSelectorLeftRight` row required error message is shown.
* Refresh the cell content instead of recreating one, when the form get back from a selection.
* Added XLFormRowDescriptor to validations error to easily show an error mask.
* Use row tag in validation error message if row does not have a title. It is also possible to set up a custom message if needed
* Added a convenience method to add a XLFormRowDescriptor instance before another one.
* Allow nil values in cellConfig and cellConfigAtConfigure.
* Fix constraints for textFieldCell when it is configured to be right aligned.
* Add asterisk to required segmentedCells if needed.
* Fail validation for empty strings and NSNull on required rows.
* Segue support added to buttons and selectors.
* Ability to configure a storyboardId or a viewController nibName to by used by button and selector rows as presented view controller.
* Fix scrolling to top when status bar is tapped.
* Fix wrong type of XLFormRowDescriptorTypeDecimal row. Now it's converted to NSNumber.
* Fix issue: XLFormRegexValidator only checks regex validation for NSStrings, not working for number.
* Callconfigure method from awakeFromNib on XLFormBaseCell.
* Assign form.delegate from inside setForm: method.
* Added custom cell, validation, reordering, can insert, can delete examples.
* Added support for inputAccessoryView. Default input accessory view allows to navigate among rows. Fully optionally and customizable.
* Added suport for row navigation. Fully optionally and customizable.
* beginEditing: endEditing: methods added. These method are called each time a row gains / loses firstResponder. They bring the ability to do UI changes.
* Read Only mode added. `disable` property added to XLFormDescriptor class.
* Rename `label` XLFormTextViewCell property as `textLabel`.
* fix position of multivalued section accessory view.
* Can delete, can delete, can reorder section mode added. it's possible to enable some of them, don't need to enable all modes.
### Version 2.1.0
* Change `XLFormRowDescriptorTypeText`, `XLFormRowDescriptorTypeName` and `XLFormRowDescriptorTypeTextView` keyboard type to `UIKeyboardTypeDefault`.
* Added `XLFormRowDescriptorTypeInfo` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPopover` row type and example.
* CI added. Created Test project into Tests folder and set up Travis.
* Documented how to customize UI. Added an example.
* Now XLFormViewController extends from UIViewController instead of UITableViewController.
* Added tableView property as a XLFormViewController IBOutlet.
* Added support for storyboard reuse identifier and nib file.
* Button selection can be handled using a selector or block.
* Added addAsteriskToRequiredRowsTitle property to XLFormDescriptor. NO is used as value by default.
* Image cell has been removed because it depends on AFNetworking and now needs to be implemented as a custom cell. You can find the image custom cell in Examples/Others/CustomCells.
### Version 2.0.0
* Added `XLFormRowDescriptorTypeMultipleSelector` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPickerView` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPickerViewInline` row type and example.
* Added generic way to create inline selector rows.
* Ability to customize row animations.
* `(NSDictionary *)formValues;` XLFormViewController method added in order to get raw form data.
* Added `XLFormRowDescriptorTypeSelectorSegmentedControl` row type and example.
* AFNetworking dependency removed.
* Added `XLFormRowDescriptorTypeStepCounter` row type and related example.
### Version 1.0.1
* Added storyboard example.
* Added button `XLFormRowDescriptorTypeButton` example.
* Documented how to add a custom row.
* Fixed issues: [#2](https://github.com/xmartlabs/XLForm/issues/2 "#2"), [#3](https://github.com/xmartlabs/XLForm/issues/3 "#3"), [#27](https://github.com/xmartlabs/XLForm/issues/27 "#27"), [#38](https://github.com/xmartlabs/XLForm/issues/38 "#38").
* Fixed crash caused by inline date rows. [#6](https://github.com/xmartlabs/XLForm/issues/6 "#6")
* Fixed ipad issue *invalid cell layout*. [#10](https://github.com/xmartlabs/XLForm/issues/10 "#10")
* New convenience methods to insert sections dinamically. [#13](https://github.com/xmartlabs/XLForm/pull/13 "#13")
* Change default label style to `UIFontTextStyleBody`. [#18](https://github.com/xmartlabs/XLForm/issues/18 "#18")
* Added step counter row, `XLFormRowDescriptorTypeStepCounter`.
* Added `initWithCoder` initializer to `XLFormViewController`. [#32](https://github.com/xmartlabs/XLForm/issues/32 "#32").
* Added a convenience method to deselect a `XLFormRowDescriptor`. `-(void)deselectFormRow:(XLFormRowDescriptor *)row;`. [#33](https://github.com/xmartlabs/XLForm/issues/33 "#33").
### Version 1.0.0
* Initial release
@@ -28,11 +28,13 @@
#import "XLFormRatingCell.h"
#import "FloatLabeledTextFieldCell.h"
#import "XLFormCustomCell.h"
#import "XLFormInlineSegmentedCell.h"
static NSString * const kCustomRowFirstRatingTag = @"CustomRowFirstRatingTag";
static NSString * const kCustomRowSecondRatingTag = @"CustomRowSecondRatingTag";
static NSString * const kCustomRowFloatLabeledTextFieldTag = @"CustomRowFloatLabeledTextFieldTag";
static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays";
static NSString * const kCustomInline = @"kCustomInline";
static NSString * const kCustomRowText = @"kCustomText";
@implementation CustomRowsViewController
@@ -94,6 +96,16 @@ static NSString * const kCustomRowText = @"kCustomText";
};
[section addFormRow:row];
// Custom Inline Segmented row
section = [XLFormSectionDescriptor formSectionWithTitle:@"Custom Inline"];
[form addFormSection:section];
// Inline segmented
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomInline rowType:XLFormRowDescriptorTypeSegmentedInline];
row.title = @"You support...";
row.selectorOptions = @[@"Uruguay", @"Brazil", @"Argentina", @"Chile"];
row.value = @"Uruguay";
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
@@ -57,6 +57,7 @@ NSString *const kCountDownTimer = @"countDownTimer";
// Date
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDateInline rowType:XLFormRowDescriptorTypeDateInline title:@"Date"];
row.value = [NSDate new];
[row.cellConfigAtConfigure setObject:[NSLocale localeWithLocaleIdentifier:@"FR_fr" ] forKey:@"locale"];
[section addFormRow:row];
// Time
@@ -34,6 +34,7 @@
#import "CustomRowsViewController.h"
#import "AccessoryViewFormViewController.h"
#import "PredicateFormViewController.h"
#import "FormattersViewController.h"
NSString * const kTextFieldAndTextView = @"TextFieldAndTextView";
NSString * const kSelectors = @"Selectors";
@@ -46,6 +47,7 @@ NSString * const kMultivaluedOnlyReorder = @"MultivaluedOnlyReorder";
NSString * const kMultivaluedOnlyInsert = @"MultivaluedOnlyInsert";
NSString * const kMultivaluedOnlyDelete = @"MultivaluedOnlyDelete";
NSString * const kValidations= @"Validations";
NSString * const kFormatters = @"Formatters";
@interface ExamplesFormViewController ()
@@ -113,6 +115,11 @@ NSString * const kValidations= @"Validations";
row.action.viewControllerClass = [DatesFormViewController class];
[section addFormRow:row];
// NSFormatters
row = [XLFormRowDescriptor formRowDescriptorWithTag:kFormatters rowType:XLFormRowDescriptorTypeButton title:@"NSFormatter Support"];
row.action.viewControllerClass = [FormattersViewController class];
[section addFormRow:row];
// Others
row = [XLFormRowDescriptor formRowDescriptorWithTag:kOthes rowType:XLFormRowDescriptorTypeButton title:@"Other Rows"];
row.action.formSegueIdentifier = @"OthersFormViewControllerSegue";
@@ -0,0 +1,13 @@
//
// FormattersViewController.h
// XLForm
//
// Created by Freddy Henin on 12/29/14.
// Copyright (c) 2014 Xmartlabs. All rights reserved.
//
#import "XLFormViewController.h"
@interface FormattersViewController : XLFormViewController
@end
@@ -0,0 +1,120 @@
//
// FormattersViewController.m
// XLForm
//
// Created by Freddy Henin on 12/29/14.
// Copyright (c) 2014 Xmartlabs. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XLForm.h"
#import "FormattersViewController.h"
#import <SHSPhoneComponent/SHSPhoneNumberFormatter+UserConfig.h>
// Simple little class to demonstraite currency formatting. Unfortunally we have to subclass
// NSNumberFormatter to work aroundn some long known rounding bugs with NSNumberFormatter
// http://stackoverflow.com/questions/12580162/nsstring-to-nsdate-conversion-issue
@interface CurrencyFormatter : NSNumberFormatter
@property (readonly) NSDecimalNumberHandler *roundingBehavior;
@end
@implementation CurrencyFormatter
- (id) init
{
self = [super init];
if (self) {
[self setNumberStyle: NSNumberFormatterCurrencyStyle];
[self setGeneratesDecimalNumbers:YES];
NSUInteger currencyScale = [self maximumFractionDigits];
_roundingBehavior = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundPlain scale:currencyScale raiseOnExactness:FALSE raiseOnOverflow:TRUE raiseOnUnderflow:TRUE raiseOnDivideByZero:TRUE];
}
return self;
}
//- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error
//{
// NSDecimalNumber *number;
// BOOL success = [super getObjectValue:&number forString:string errorDescription:error];
//
// if (success) {
// *anObject = [number decimalNumberByRoundingAccordingToBehavior:_roundingBehavior];
// }
// else {
// *anObject = nil;
// }
//
// return success;
//}
@end
@interface FormattersViewController ()
@end
@implementation FormattersViewController
-(id)init
{
XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"Text Fields"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
formDescriptor.assignFirstResponderOnShow = NO;
section = [XLFormSectionDescriptor formSection];
section.title = @"NSFormatter Support";
section.footerTitle = @"Rows can be configured to use the formatter as you type or to toggle on and off during for display/editing. You will most likely need custom NSFormatter objects to do on the fly formatting since NSNumberFormatter is pretty limited in this regard.";
[formDescriptor addFormSection:section];
// Phone
SHSPhoneNumberFormatter *formatter = [[SHSPhoneNumberFormatter alloc] init];
[formatter setDefaultOutputPattern:@"(###) ###-####" imagePath:nil];
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"phone" rowType:XLFormRowDescriptorTypePhone title:@"US Phone"];
row.valueFormatter = formatter;
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.useValueFormatterDuringInput = YES;
[section addFormRow:row];
// Currency
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"currency" rowType:XLFormRowDescriptorTypeDecimal title:@"USD"];
CurrencyFormatter *numberFormatter = [[CurrencyFormatter alloc] init];
row.valueFormatter = numberFormatter;
row.value = [NSDecimalNumber numberWithDouble:9.95];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
[section addFormRow:row];
// Accounting
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"percent" rowType:XLFormRowDescriptorTypeNumber title:@"Test Score"];
NSNumberFormatter *acctFormatter = [[NSNumberFormatter alloc] init];
[acctFormatter setNumberStyle:NSNumberFormatterPercentStyle];
row.valueFormatter = acctFormatter;
row.value = @(0.75);
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"megabytes" rowType:XLFormRowDescriptorTypeInfo title:@"Megabytes"];
row.valueFormatter = [NSByteCountFormatter new];
row.value = @(1024);
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[formDescriptor addFormSection:section];
return [super initWithForm:formDescriptor];
}
@end
@@ -74,13 +74,14 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
[form addFormSection:section];
// Switch
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchBool rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Switch"]];
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kSwitchBool rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Switch"];
[row.cellConfigAtConfigure setObject:[UIColor redColor] forKey:@"switchControl.onTintColor"];
[section addFormRow:row];
// check
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"]];
// step counter
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"];
row.value = @50;
[row.cellConfigAtConfigure setObject:@YES forKey:@"stepControl.wraps"];
[row.cellConfigAtConfigure setObject:@10 forKey:@"stepControl.stepValue"];
@@ -212,11 +212,13 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:1];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"] httpParameterKey:@"option_2" rightOptions:mutableRightOptions];
leftRightSelectorOption.leftValueChangePolicy = XLFormLeftRightSelectorOptionLeftValueChangePolicyChooseFirstOption;
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:2];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"] httpParameterKey:@"option_3" rightOptions:mutableRightOptions];
leftRightSelectorOption.leftValueChangePolicy = XLFormLeftRightSelectorOptionLeftValueChangePolicyChooseLastOption;
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
@@ -0,0 +1,22 @@
//
// XLFormInlineSegmentedCell.h
// XLForm
//
// Created by mathias Claassen on 16/12/15.
// Copyright © 2015 Xmartlabs. All rights reserved.
//
#import <XLForm/XLForm.h>
extern NSString * const XLFormRowDescriptorTypeSegmentedInline;
extern NSString * const XLFormRowDescriptorTypeSegmentedControl;
@interface XLFormInlineSegmentedCell : XLFormBaseCell
@end
@interface XLFormInlineSegmentedControl : XLFormBaseCell<XLFormInlineRowDescriptorCell>
@property (strong, nonatomic) UISegmentedControl* segmentedControl;
@end
@@ -0,0 +1,194 @@
//
// XLFormInlineSegmentedCell.m
// XLForm
//
// Created by mathias Claassen on 16/12/15.
// Copyright © 2015 Xmartlabs. All rights reserved.
//
#import "XLFormInlineSegmentedCell.h"
NSString * const XLFormRowDescriptorTypeSegmentedInline = @"XLFormRowDescriptorTypeSegmentedInline";
NSString * const XLFormRowDescriptorTypeSegmentedControl = @"XLFormRowDescriptorTypeSegmentedControl";
@implementation XLFormInlineSegmentedCell
+(void)load
{
[XLFormViewController.cellClassesForRowDescriptorTypes setObject:[XLFormInlineSegmentedCell class] forKey:XLFormRowDescriptorTypeSegmentedInline];
[XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes setObject:XLFormRowDescriptorTypeSegmentedControl forKey:XLFormRowDescriptorTypeSegmentedInline];
}
- (BOOL)canBecomeFirstResponder
{
return YES;
}
-(BOOL)becomeFirstResponder
{
if (self.isFirstResponder){
return [super becomeFirstResponder];
}
BOOL result = [super becomeFirstResponder];
if (result){
XLFormRowDescriptor * inlineRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:[XLFormViewController inlineRowDescriptorTypesForRowDescriptorTypes][self.rowDescriptor.rowType]];
UITableViewCell<XLFormDescriptorCell> * cell = [inlineRowDescriptor cellForFormController:self.formViewController];
NSAssert([cell conformsToProtocol:@protocol(XLFormInlineRowDescriptorCell)], @"inline cell must conform to XLFormInlineRowDescriptorCell");
UITableViewCell<XLFormInlineRowDescriptorCell> * inlineCell = (UITableViewCell<XLFormInlineRowDescriptorCell> *)cell;
inlineCell.inlineRowDescriptor = self.rowDescriptor;
[self.rowDescriptor.sectionDescriptor addFormRow:inlineRowDescriptor afterRow:self.rowDescriptor];
[self.formViewController ensureRowIsVisible:inlineRowDescriptor];
}
return result;
}
-(BOOL)resignFirstResponder
{
if (![self isFirstResponder]) {
return [super resignFirstResponder];
}
NSIndexPath * selectedRowPath = [self.formViewController.form indexPathOfFormRow:self.rowDescriptor];
NSIndexPath * nextRowPath = [NSIndexPath indexPathForRow:selectedRowPath.row + 1 inSection:selectedRowPath.section];
XLFormRowDescriptor * nextFormRow = [self.formViewController.form formRowAtIndex:nextRowPath];
XLFormSectionDescriptor * formSection = [self.formViewController.form.formSections objectAtIndex:nextRowPath.section];
BOOL result = [super resignFirstResponder];
if (result) {
[formSection removeFormRow:nextFormRow];
}
return result;
}
#pragma mark - XLFormDescriptorCell
-(void)configure
{
[super configure];
}
-(void)update
{
[super update];
self.accessoryType = UITableViewCellAccessoryNone;
self.editingAccessoryType = UITableViewCellAccessoryNone;
[self.textLabel setText:self.rowDescriptor.title];
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.detailTextLabel.text = [self valueDisplayText];
}
-(BOOL)formDescriptorCellCanBecomeFirstResponder
{
return !(self.rowDescriptor.isDisabled);
}
-(BOOL)formDescriptorCellBecomeFirstResponder
{
if ([self isFirstResponder]){
[self resignFirstResponder];
return NO;
}
return [self becomeFirstResponder];
}
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
{
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
}
#pragma mark - Helpers
-(NSString *)valueDisplayText
{
return (self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText);
}
@end
@implementation XLFormInlineSegmentedControl
@synthesize segmentedControl = _segmentedControl;
@synthesize inlineRowDescriptor = _inlineRowDescriptor;
+(void)load
{
[XLFormViewController.cellClassesForRowDescriptorTypes setObject:[XLFormInlineSegmentedControl class] forKey:XLFormRowDescriptorTypeSegmentedControl];
}
-(void)configure
{
[super configure];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.segmentedControl];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[segmentedControl]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:0
views:@{@"segmentedControl": self.segmentedControl}]];
[self.segmentedControl addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged];
}
-(void)update
{
[super update];
[self updateSegmentedControl];
self.segmentedControl.selectedSegmentIndex = [self selectedIndex];
self.segmentedControl.enabled = !self.rowDescriptor.isDisabled;
}
-(UISegmentedControl *)segmentedControl
{
if (_segmentedControl) return _segmentedControl;
_segmentedControl = [UISegmentedControl autolayoutView];
[_segmentedControl setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal];
return _segmentedControl;
}
#pragma mark - Action
-(void)valueChanged
{
self.inlineRowDescriptor.value = [self.inlineRowDescriptor.selectorOptions objectAtIndex:self.segmentedControl.selectedSegmentIndex];
[self.formViewController updateFormRow:self.inlineRowDescriptor];
}
#pragma mark - Helper
-(NSArray *)getItems
{
NSMutableArray * result = [[NSMutableArray alloc] init];
for (id option in self.inlineRowDescriptor.selectorOptions)
[result addObject:[option displayText]];
return result;
}
-(void)updateSegmentedControl
{
[self.segmentedControl removeAllSegments];
[[self getItems] enumerateObjectsUsingBlock:^(id object, NSUInteger idex, __unused BOOL *stop){
[self.segmentedControl insertSegmentWithTitle:[object displayText] atIndex:idex animated:NO];
}];
}
-(NSInteger)selectedIndex
{
XLFormRowDescriptor * formRow = self.inlineRowDescriptor ?: self.rowDescriptor;
if (formRow.value){
for (id option in formRow.selectorOptions){
if ([[option valueData] isEqual:[formRow.value valueData]]){
return [formRow.selectorOptions indexOfObject:option];
}
}
}
return -1;
}
@end
+4
View File
@@ -1,6 +1,8 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'XLForm' do
pod 'XLForm', :path => '../../'
#Following pods are used for custom row examples
@@ -8,3 +10,5 @@ pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true
pod 'XLData', :git => 'https://github.com/xmartlabs/XLData.git', :commit => '1f9019b56242a2019c7f7e11ec4ef823c397ebcf', :inhibit_warnings => true
pod 'JVFloatLabeledTextField', '1.0.2', :inhibit_warnings => true
pod 'AXRatingView', '1.0.3', :inhibit_warnings => true
pod 'SHSPhoneComponent'
end
+78
View File
@@ -0,0 +1,78 @@
PODS:
- AFNetworking (2.6.3):
- AFNetworking/NSURLConnection (= 2.6.3)
- AFNetworking/NSURLSession (= 2.6.3)
- AFNetworking/Reachability (= 2.6.3)
- AFNetworking/Security (= 2.6.3)
- AFNetworking/Serialization (= 2.6.3)
- AFNetworking/UIKit (= 2.6.3)
- AFNetworking/NSURLConnection (2.6.3):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/NSURLSession (2.6.3):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (2.6.3)
- AFNetworking/Security (2.6.3)
- AFNetworking/Serialization (2.6.3)
- AFNetworking/UIKit (2.6.3):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- AXRatingView (1.0.3)
- JVFloatLabeledTextField (1.0.2)
- SHSPhoneComponent (2.15)
- XLData (2.0.0):
- XLData/Core (= 2.0.0)
- XLData/CoreData (= 2.0.0)
- XLData/CoreRemote (= 2.0.0)
- XLData/DataStore (= 2.0.0)
- XLData/RemoteCoreData (= 2.0.0)
- XLData/RemoteDataStore (= 2.0.0)
- XLData/Core (2.0.0)
- XLData/CoreData (2.0.0):
- XLData/Core
- XLData/CoreRemote (2.0.0):
- AFNetworking (~> 2.0)
- XLData/DataStore (2.0.0):
- XLData/Core
- XLData/RemoteCoreData (2.0.0):
- XLData/CoreData
- XLData/CoreRemote
- XLData/RemoteDataStore (2.0.0):
- XLData/CoreRemote
- XLData/DataStore
- XLForm (3.1.2)
DEPENDENCIES:
- AFNetworking (~> 2.0)
- AXRatingView (= 1.0.3)
- JVFloatLabeledTextField (= 1.0.2)
- SHSPhoneComponent
- XLData (from `https://github.com/xmartlabs/XLData.git`, commit `1f9019b56242a2019c7f7e11ec4ef823c397ebcf`)
- XLForm (from `../../`)
EXTERNAL SOURCES:
XLData:
:commit: 1f9019b56242a2019c7f7e11ec4ef823c397ebcf
:git: https://github.com/xmartlabs/XLData.git
XLForm:
:path: ../../
CHECKOUT OPTIONS:
XLData:
:commit: 1f9019b56242a2019c7f7e11ec4ef823c397ebcf
:git: https://github.com/xmartlabs/XLData.git
SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
AXRatingView: ccaadc1bbda99a4b7e1d556059482d2b933a9f4e
JVFloatLabeledTextField: 58a3a32cfb800e5b224f676987e7c13abf50a14d
SHSPhoneComponent: 4cec0653a150ad63cbc52b0c8b29ce2d3c9c26f0
XLData: df725c6179e2e0c80bf56a1ecad9afd169707a6d
XLForm: 6bb3c20857e2983cf494cb8b4d666c2a24673d5e
PODFILE CHECKSUM: 80615792e859be64c95add3bb57c1596234faf95
COCOAPODS: 1.0.0
@@ -33,7 +33,6 @@
28A85D5918E346C100E81A26 /* XLFormImageSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A85D5818E346C100E81A26 /* XLFormImageSelectorCell.m */; };
28DBB04118D76FDC00FB8A8B /* MultivaluedFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28DBB04018D76FDC00FB8A8B /* MultivaluedFormViewController.m */; };
28F89F2E1AA4EA5600E90218 /* ValidationExamplesFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28F89F2D1AA4EA5600E90218 /* ValidationExamplesFormViewController.m */; };
2CA9A3FC06E94345A2FDE415 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F6DF43B7BBF44F72A4493E8E /* libPods.a */; };
3C0357F01AB0D82300200C8A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3C0357EF1AB0D82300200C8A /* Images.xcassets */; };
3C3B01D51AB741EF0027CD45 /* XLFormRatingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01D31AB741EF0027CD45 /* XLFormRatingCell.m */; };
3C3B01DA1AB7497D0027CD45 /* XLFormWeekDaysCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01D81AB7497D0027CD45 /* XLFormWeekDaysCell.m */; };
@@ -41,16 +40,20 @@
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01E01AB7499A0027CD45 /* XLRatingView.m */; };
3C3B01F01AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01EF1AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m */; };
3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDAFC791AB0AFA4000F75B6 /* CustomRowsViewController.m */; };
5BB6B032D80344C9E7D956CD /* libPods-XLForm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19383D268EF8024CB33FCCA4 /* libPods-XLForm.a */; };
66B6266E1AE0055100007886 /* DateAndTimeValueTrasformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */; };
BF01E9281C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */; };
BF9DB1D51AE0436600B985E7 /* BlogExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */; };
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D41AE0436600B985E7 /* PredicateFormViewController.m */; };
BFA5F4B11BB48F8E00D045BD /* XLFormRatingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D41AB741EF0027CD45 /* XLFormRatingCell.xib */; };
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */; };
D51B8B2C19126664008C0478 /* XLFormCustomCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D51B8B2B19126664008C0478 /* XLFormCustomCell.m */; };
DEA6EF911B57D6CC000F4893 /* HTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.m */; };
DEB8235C1AD5529A00AF9FE2 /* FormattersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DEB8235B1AD5529A00AF9FE2 /* FormattersViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
19383D268EF8024CB33FCCA4 /* libPods-XLForm.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XLForm.a"; sourceTree = BUILT_PRODUCTS_DIR; };
281E5BE719538F4A006D93C5 /* CLLocationValueTrasformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLLocationValueTrasformer.h; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.h; sourceTree = "<group>"; };
281E5BE819538F4A006D93C5 /* CLLocationValueTrasformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CLLocationValueTrasformer.m; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/CLLocationValueTrasformer.m; sourceTree = "<group>"; };
282EB27A1AB5FF33004A736F /* AccessoryViewFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessoryViewFormViewController.h; path = Examples/AccessoryViews/AccessoryViewFormViewController.h; sourceTree = "<group>"; };
@@ -110,10 +113,12 @@
3C3B01EF1AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FloatLabeledTextFieldCell.m; path = Examples/CustomRows/FloatLabeledTextField/FloatLabeledTextFieldCell.m; sourceTree = "<group>"; };
3CDAFC781AB0AFA4000F75B6 /* CustomRowsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomRowsViewController.h; path = Examples/CustomRows/CustomRowsViewController.h; sourceTree = "<group>"; };
3CDAFC791AB0AFA4000F75B6 /* CustomRowsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CustomRowsViewController.m; path = Examples/CustomRows/CustomRowsViewController.m; sourceTree = "<group>"; };
5F6FC67A75254B60005DC716 /* Pods-XLForm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm.debug.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm/Pods-XLForm.debug.xcconfig"; sourceTree = "<group>"; };
66B6266C1AE0055100007886 /* DateAndTimeValueTrasformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DateAndTimeValueTrasformer.h; path = Examples/Dates/DateAndTimeValueTrasformer.h; sourceTree = "<group>"; };
66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DateAndTimeValueTrasformer.m; path = Examples/Dates/DateAndTimeValueTrasformer.m; sourceTree = "<group>"; };
7B0D2D6A86E2A41ED22E8A35 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
976A33EE62A018A7257B4878 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
B98C1213E7C714A861219C81 /* Pods-XLForm.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm.release.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm/Pods-XLForm.release.xcconfig"; sourceTree = "<group>"; };
BF01E9261C21F0BB00BDE045 /* XLFormInlineSegmentedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLFormInlineSegmentedCell.h; path = "Inline Segmented/XLFormInlineSegmentedCell.h"; sourceTree = "<group>"; };
BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormInlineSegmentedCell.m; path = "Inline Segmented/XLFormInlineSegmentedCell.m"; sourceTree = "<group>"; };
BF9DB1D11AE0436600B985E7 /* BlogExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlogExampleViewController.h; path = Examples/PredicateExamples/BlogExampleViewController.h; sourceTree = SOURCE_ROOT; };
BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BlogExampleViewController.m; path = Examples/PredicateExamples/BlogExampleViewController.m; sourceTree = SOURCE_ROOT; };
BF9DB1D31AE0436600B985E7 /* PredicateFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PredicateFormViewController.h; path = Examples/PredicateExamples/PredicateFormViewController.h; sourceTree = SOURCE_ROOT; };
@@ -124,7 +129,8 @@
D51B8B2B19126664008C0478 /* XLFormCustomCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormCustomCell.m; path = Examples/Others/CustomCells/XLFormCustomCell.m; sourceTree = "<group>"; };
DEA6EF8F1B57D6CC000F4893 /* HTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSessionManager.h; path = Examples/Selectors/HTTPSessionManager.h; sourceTree = "<group>"; };
DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPSessionManager.m; path = Examples/Selectors/HTTPSessionManager.m; sourceTree = "<group>"; };
F6DF43B7BBF44F72A4493E8E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
DEB8235A1AD5529A00AF9FE2 /* FormattersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormattersViewController.h; sourceTree = "<group>"; };
DEB8235B1AD5529A00AF9FE2 /* FormattersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FormattersViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -136,22 +142,13 @@
2850C5FE18D0F706002B7D0A /* CoreGraphics.framework in Frameworks */,
2850C60018D0F706002B7D0A /* UIKit.framework in Frameworks */,
2850C5FC18D0F706002B7D0A /* Foundation.framework in Frameworks */,
2CA9A3FC06E94345A2FDE415 /* libPods.a in Frameworks */,
5BB6B032D80344C9E7D956CD /* libPods-XLForm.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
15E61D225B0D27FAB51BDD90 /* Pods */ = {
isa = PBXGroup;
children = (
7B0D2D6A86E2A41ED22E8A35 /* Pods.debug.xcconfig */,
976A33EE62A018A7257B4878 /* Pods.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
282C5EEF18D33C1800A5D47C /* Inputs */ = {
isa = PBXGroup;
children = (
@@ -258,7 +255,7 @@
2850C60118D0F706002B7D0A /* XLForm */,
2850C5FA18D0F706002B7D0A /* Frameworks */,
2850C5F918D0F706002B7D0A /* Products */,
15E61D225B0D27FAB51BDD90 /* Pods */,
B6478577DDCB0DDDD433C572 /* Pods */,
);
sourceTree = "<group>";
};
@@ -277,7 +274,7 @@
2850C5FB18D0F706002B7D0A /* Foundation.framework */,
2850C5FD18D0F706002B7D0A /* CoreGraphics.framework */,
2850C5FF18D0F706002B7D0A /* UIKit.framework */,
F6DF43B7BBF44F72A4493E8E /* libPods.a */,
19383D268EF8024CB33FCCA4 /* libPods-XLForm.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -309,6 +306,7 @@
282EB2791AB5FD66004A736F /* AccessoryViews */,
3CDAFC741AB0AEE5000F75B6 /* CustomRows */,
28F89F2B1AA4E99500E90218 /* Validations */,
DEB823591AD5529A00AF9FE2 /* Formatters */,
283C6B7A1999BA1B00A5283D /* UICustomization */,
28A76624193251E500D69546 /* AppDelegate.m */,
28A8083C190D903D009D77F8 /* StoryboardExample */,
@@ -416,6 +414,7 @@
3CDAFC741AB0AEE5000F75B6 /* CustomRows */ = {
isa = PBXGroup;
children = (
BF01E9251C21F02D00BDE045 /* Inline Segmented */,
3C3B01D01AB741C40027CD45 /* Rating */,
3C3B01E31AB74AC10027CD45 /* FloatLabeledTextField */,
3C3B01D11AB741CC0027CD45 /* Weekdays */,
@@ -425,6 +424,24 @@
name = CustomRows;
sourceTree = "<group>";
};
B6478577DDCB0DDDD433C572 /* Pods */ = {
isa = PBXGroup;
children = (
5F6FC67A75254B60005DC716 /* Pods-XLForm.debug.xcconfig */,
B98C1213E7C714A861219C81 /* Pods-XLForm.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
BF01E9251C21F02D00BDE045 /* Inline Segmented */ = {
isa = PBXGroup;
children = (
BF01E9261C21F0BB00BDE045 /* XLFormInlineSegmentedCell.h */,
BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */,
);
name = "Inline Segmented";
sourceTree = "<group>";
};
BFD5D6F41AD2FFC1006F04FA /* PredicateExamples */ = {
isa = PBXGroup;
children = (
@@ -448,6 +465,16 @@
name = SessionManager;
sourceTree = "<group>";
};
DEB823591AD5529A00AF9FE2 /* Formatters */ = {
isa = PBXGroup;
children = (
DEB8235A1AD5529A00AF9FE2 /* FormattersViewController.h */,
DEB8235B1AD5529A00AF9FE2 /* FormattersViewController.m */,
);
name = Formatters;
path = Examples/Formatters;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -455,12 +482,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 2850C62418D0F707002B7D0A /* Build configuration list for PBXNativeTarget "XLForm" */;
buildPhases = (
0EA9FCE3DA0D444498836D37 /* Check Pods Manifest.lock */,
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */,
2850C5F418D0F706002B7D0A /* Sources */,
2850C5F518D0F706002B7D0A /* Frameworks */,
2850C5F618D0F706002B7D0A /* Resources */,
CFE72E068B5F4D9BB45FB757 /* Copy Pods Resources */,
734CC62A7A974D37CC982576 /* Embed Pods Frameworks */,
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */,
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */,
);
buildRules = (
);
@@ -515,14 +542,44 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0EA9FCE3DA0D444498836D37 /* Check Pods Manifest.lock */ = {
32EB30E0A90A4E91864B1D3C /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
DE3D12F5596780A66C6C3D4A /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm/Pods-XLForm-resources.sh\"\n";
showEnvVarsInLog = 0;
};
EBE0335CCC7588D83B89A92A /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -530,36 +587,6 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
734CC62A7A974D37CC982576 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CFE72E068B5F4D9BB45FB757 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -590,8 +617,10 @@
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */,
283B59B219532415000828CD /* MapViewController.m in Sources */,
2843EB4718D4915800F13E2B /* ExamplesFormViewController.m in Sources */,
BF01E9281C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m in Sources */,
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */,
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */,
DEB8235C1AD5529A00AF9FE2 /* FormattersViewController.m in Sources */,
2843EB5218D4CFC700F13E2B /* OthersFormViewController.m in Sources */,
2843EB4B18D496F600F13E2B /* SelectorsFormViewController.m in Sources */,
28468EA418EF41D300DBB015 /* InputsFormViewController.m in Sources */,
@@ -694,7 +723,7 @@
};
2850C62518D0F707002B7D0A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7B0D2D6A86E2A41ED22E8A35 /* Pods.debug.xcconfig */;
baseConfigurationReference = 5F6FC67A75254B60005DC716 /* Pods-XLForm.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
@@ -711,10 +740,11 @@
};
2850C62618D0F707002B7D0A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 976A33EE62A018A7257B4878 /* Pods.release.xcconfig */;
baseConfigurationReference = B98C1213E7C714A861219C81 /* Pods-XLForm.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
@@ -1,250 +0,0 @@
//
// AccessoryViewFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "AccessoryViewFormViewController.h"
//This macro defines if we use predicates to hide rows or do it manually the old way.
//Just comment out if you want it to run without predicates.
#define USE_PREDICATES_FOR_HIDING
@interface AccessoryViewFormViewController ()
@end
@implementation AccessoryViewFormViewController
{
#ifndef USE_PREDICATES_FOR_HIDING
XLFormRowDescriptor * _rowShowAccessoryView;
XLFormRowDescriptor * _rowStopDisableRow;
XLFormRowDescriptor * _rowStopInlineRow;
XLFormRowDescriptor * _rowSkipCanNotBecomeFirstResponderRow;
#endif
}
NSString * kAccessoryViewRowNavigationEnabled = @"kRowNavigationEnabled";
NSString * kAccessoryViewRowNavigationShowAccessoryView = @"kRowNavigationShowAccessoryView";
NSString * kAccessoryViewRowNavigationStopDisableRow = @"rowNavigationStopDisableRow";
NSString * kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow = @"rowNavigationSkipCanNotBecomeFirstResponderRow";
NSString * kAccessoryViewRowNavigationStopInlineRow = @"rowNavigationStopInlineRow";
NSString * kAccessoryViewName = @"name";
NSString * kAccessoryViewEmail = @"email";
NSString * kAccessoryViewTwitter = @"twitter";
NSString * kAccessoryViewUrl = @"url";
NSString * kAccessoryViewDate = @"date";
NSString * kAccessoryViewTextView = @"textView";
NSString * kAccessoryViewCheck = @"check";
NSString * kAccessoryViewNotes = @"notes";
-(id)init
{
self = [super init];
if (self) {
[self initializeForm];
}
return self;
}
-(void)initializeForm
{
XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"Accessory View"];
formDescriptor.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
XLFormRowDescriptor * switchRow;
// Configuration section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Row Navigation Settings"];
section.footerTitle = @"Changing the Settings values you will navigate differently";
[formDescriptor addFormSection:section];
// RowNavigationEnabled
switchRow = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationEnabled rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Row Navigation Enabled?"];
switchRow.value = @YES;
[section addFormRow:switchRow];
// RowNavigationShowAccessoryView
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationShowAccessoryView rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Show input accessory row?"];
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionEnabled) == XLFormRowNavigationOptionEnabled);
[section addFormRow:row];
#ifdef USE_PREDICATES_FOR_HIDING
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
#else
_rowShowAccessoryView = row;
#endif
// RowNavigationStopDisableRow
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopDisableRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach disabled row?"];
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopDisableRow) == XLFormRowNavigationOptionStopDisableRow);
[section addFormRow:row];
#ifdef USE_PREDICATES_FOR_HIDING
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
#else
_rowStopDisableRow = row;
#endif
// RowNavigationStopInlineRow
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationStopInlineRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Stop when reach inline row?"];
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionStopInlineRow) == XLFormRowNavigationOptionStopInlineRow);
[section addFormRow:row];
#ifdef USE_PREDICATES_FOR_HIDING
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
#else
_rowStopInlineRow = row;
#endif
// RowNavigationSkipCanNotBecomeFirstResponderRow
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Skip Can Not Become First Responder Row?"];
row.value = @((formDescriptor.rowNavigationOptions & XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow) == XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
[section addFormRow:row];
#ifdef USE_PREDICATES_FOR_HIDING
row.hidden = [NSString stringWithFormat:@"$%@ == 0", switchRow];
#else
_rowSkipCanNotBecomeFirstResponderRow = row;
#endif
// Basic Information - Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextField Types"];
section.footerTitle = @"This is a long text that will appear on section footer";
[formDescriptor addFormSection:section];
// Name
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewName rowType:XLFormRowDescriptorTypeText title:@"Name"];
row.required = YES;
[section addFormRow:row];
// Email
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewEmail rowType:XLFormRowDescriptorTypeEmail title:@"Email"];
// validate the email
[row addValidator:[XLFormValidator emailValidator]];
[section addFormRow:row];
// Twitter
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewTwitter rowType:XLFormRowDescriptorTypeTwitter title:@"Twitter"];
row.disabled = @YES;
row.value = @"@no_editable";
[section addFormRow:row];
// Url
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewUrl rowType:XLFormRowDescriptorTypeURL title:@"Url"];
[section addFormRow:row];
// Url
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewDate rowType:XLFormRowDescriptorTypeDateInline title:@"Date Inline"];
row.value = [NSDate new];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[formDescriptor addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewTextView rowType:XLFormRowDescriptorTypeTextView];
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextView With Label Example"];
[formDescriptor addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewNotes rowType:XLFormRowDescriptorTypeTextView title:@"Notes"];
[section addFormRow:row];
self.form = formDescriptor;
}
#pragma mark - XLFormDescriptorDelegate
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
{
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
#ifndef USE_PREDICATES_FOR_HIDING
NSString * kRowNavigationEnabled = @"kRowNavigationEnabled";
if ([rowDescriptor.tag isEqualToString:kRowNavigationEnabled]){
if ([[rowDescriptor.value valueData] isEqual:@NO]){
self.form.rowNavigationOptions = XLFormRowNavigationOptionNone;
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationShowAccessoryView];
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationStopDisableRow];
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationStopInlineRow];
[self.form removeFormRowWithTag:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow];
}
else{
self.form.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
_rowShowAccessoryView.value = @YES;
_rowStopDisableRow.value = @NO;
_rowStopInlineRow.value = @NO;
_rowSkipCanNotBecomeFirstResponderRow.value = @NO;
[self.form addFormRow:_rowShowAccessoryView afterRow:rowDescriptor];
[self.form addFormRow:_rowStopDisableRow afterRow:_rowShowAccessoryView];
[self.form addFormRow:_rowStopInlineRow afterRow:_rowStopDisableRow];
[self.form addFormRow:_rowSkipCanNotBecomeFirstResponderRow afterRow:_rowStopInlineRow];
}
}
else
#endif
if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopDisableRow]){
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionStopDisableRow;
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionStopDisableRow);
}
}
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationStopInlineRow]){
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionStopInlineRow;
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionStopInlineRow);
}
}
else if ([rowDescriptor.tag isEqualToString:kAccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow]){
if ([[rowDescriptor.value valueData] isEqual:@(YES)]){
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow;
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptionSkipCanNotBecomeFirstResponderRow);
}
}
}
-(UIView *)inputAccessoryViewForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
{
if ([[[self.form formRowWithTag:kAccessoryViewRowNavigationShowAccessoryView].value valueData] isEqual:@NO]){
return nil;
}
return [super inputAccessoryViewForRowDescriptor:rowDescriptor];
}
@end
@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="478" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="OGo-4x-YLf" id="hV6-xt-6pq">
<rect key="frame" x="0.0" y="0.0" width="478" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yhI-dj-sRk" customClass="XLRatingView" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="353" y="11" width="115" height="22"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="85e-Ov-qM7"/>
<constraint firstAttribute="width" constant="115" id="kOb-W4-HPs"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rate" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vxp-gw-YTt">
<rect key="frame" x="15" y="11" width="338" height="21"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="21" id="IK4-8e-SFs"/>
<constraint firstAttribute="width" constant="150" id="hNG-F9-1wj"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
<exclude reference="hNG-F9-1wj"/>
</mask>
</variation>
</label>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="bottom" secondItem="Vxp-gw-YTt" secondAttribute="bottom" constant="11" id="0Qz-iR-Tzb"/>
<constraint firstAttribute="centerY" secondItem="Vxp-gw-YTt" secondAttribute="centerY" id="4Vh-2e-m2p"/>
<constraint firstAttribute="trailing" secondItem="yhI-dj-sRk" secondAttribute="trailing" constant="10" id="NPC-r7-JFl"/>
<constraint firstAttribute="centerY" secondItem="yhI-dj-sRk" secondAttribute="centerY" id="Vw4-h8-wId"/>
<constraint firstItem="Vxp-gw-YTt" firstAttribute="leading" secondItem="hV6-xt-6pq" secondAttribute="leading" constant="15" id="Xgq-Cy-zLQ"/>
<constraint firstItem="Vxp-gw-YTt" firstAttribute="top" secondItem="hV6-xt-6pq" secondAttribute="top" constant="11" id="bgO-t8-Rjz"/>
<constraint firstItem="yhI-dj-sRk" firstAttribute="leading" secondItem="Vxp-gw-YTt" secondAttribute="trailing" id="n0B-tg-Pik"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="rateTitle" destination="Vxp-gw-YTt" id="0Qh-NC-yq5"/>
<outlet property="ratingView" destination="yhI-dj-sRk" id="BKM-pX-m9F"/>
</connections>
<point key="canvasLocation" x="301" y="260"/>
</tableViewCell>
</objects>
</document>
@@ -1,249 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="382" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="piA-L5-eiN" id="Yr6-3E-keb">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZAg-Me-yKR">
<rect key="frame" x="5" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="K4V-Xd-Bak"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UjQ-Cw-7wH" userLabel="separator 1">
<rect key="frame" x="58" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="K3N-3h-MZr"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="N3w-qP-kRZ">
<rect key="frame" x="58" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="M">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="FaQ-oB-Nkl"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kwc-0w-V51" userLabel="separator 2">
<rect key="frame" x="111" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="3mE-sT-ql1"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cPl-47-rS8">
<rect key="frame" x="111" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="4vk-5n-jge"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EiN-2p-Oig" userLabel="separator 3">
<rect key="frame" x="164" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="JyW-GC-0A7"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6iC-Cl-RyI">
<rect key="frame" x="164" y="0.0" width="54" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="W">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="oO1-zj-XRv"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRc-5e-QAH" userLabel="separator 4">
<rect key="frame" x="218" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="W9F-iR-Leh"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eTo-Ip-reh">
<rect key="frame" x="218" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="SkQ-0a-9Fy"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dHj-rj-mjh" userLabel="separator 5">
<rect key="frame" x="271" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="h5U-x0-9nJ"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wjb-tu-QEo">
<rect key="frame" x="271" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="F">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="9A8-9a-SGG"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L7g-lu-boa" userLabel="separator 6">
<rect key="frame" x="324" y="10" width="1" height="29"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="1" id="81t-Xh-wZT"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LNf-b4-GYP">
<rect key="frame" x="324" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="I4k-Ho-KxE"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="ZAg-Me-yKR" firstAttribute="leading" secondItem="Yr6-3E-keb" secondAttribute="leading" constant="5" id="0EB-cP-ogn"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="1ZI-HN-9ew"/>
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="1pQ-h0-SEG"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" constant="1" id="2UA-Ao-KZF"/>
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="L7g-lu-boa" secondAttribute="height" id="4dj-Xx-ksP"/>
<constraint firstAttribute="bottom" secondItem="EiN-2p-Oig" secondAttribute="bottom" constant="10" id="5eK-Bu-wpU"/>
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="67F-sV-r6W"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="dHj-rj-mjh" secondAttribute="trailing" id="6ZX-Ub-2vw"/>
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="7Um-cV-f7p"/>
<constraint firstItem="LNf-b4-GYP" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="7YT-x4-m88"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="trailing" secondItem="bRc-5e-QAH" secondAttribute="leading" id="ABd-MQ-9sp"/>
<constraint firstAttribute="bottom" secondItem="UjQ-Cw-7wH" secondAttribute="bottom" constant="10" id="ASC-xR-Yxa"/>
<constraint firstAttribute="bottom" secondItem="dHj-rj-mjh" secondAttribute="bottom" constant="10" id="ASP-um-b8o"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Aac-10-vTs"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="6iC-Cl-RyI" secondAttribute="trailing" id="BL5-PL-pac"/>
<constraint firstAttribute="bottom" secondItem="ZAg-Me-yKR" secondAttribute="bottom" id="BeZ-ar-qMN"/>
<constraint firstItem="dHj-rj-mjh" firstAttribute="height" secondItem="bRc-5e-QAH" secondAttribute="height" id="DYn-Cd-g5H"/>
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="EXu-BP-ftM"/>
<constraint firstAttribute="bottom" secondItem="LNf-b4-GYP" secondAttribute="bottom" id="EYe-ne-rqO"/>
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="Fo8-Tp-bkn"/>
<constraint firstItem="dHj-rj-mjh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="GYq-pf-vR0"/>
<constraint firstItem="cPl-47-rS8" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" constant="72" id="HQ2-jA-X9g"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="I0s-Ze-pwV"/>
<constraint firstAttribute="bottom" secondItem="bRc-5e-QAH" secondAttribute="bottom" constant="10" id="InL-Hk-twg"/>
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="Jj4-jg-rdr"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="KQe-Ei-8jY"/>
<constraint firstItem="cPl-47-rS8" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="Kw5-3R-qXs"/>
<constraint firstItem="bRc-5e-QAH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="MXG-vB-U8F"/>
<constraint firstItem="ZAg-Me-yKR" firstAttribute="width" secondItem="N3w-qP-kRZ" secondAttribute="width" id="Mem-UJ-5Js"/>
<constraint firstItem="L7g-lu-boa" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="OVT-GJ-zq8"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="OYQ-8o-3j8"/>
<constraint firstItem="N3w-qP-kRZ" firstAttribute="width" secondItem="cPl-47-rS8" secondAttribute="width" id="Pl6-Xd-Krq"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="width" secondItem="LNf-b4-GYP" secondAttribute="width" id="Pro-fg-wBA"/>
<constraint firstAttribute="bottom" secondItem="6iC-Cl-RyI" secondAttribute="bottom" id="Q5M-8N-hIh"/>
<constraint firstItem="UjQ-Cw-7wH" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="RGn-ja-FRD"/>
<constraint firstAttribute="trailing" secondItem="LNf-b4-GYP" secondAttribute="trailing" constant="5" id="RlS-d5-rIx"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="trailing" secondItem="cPl-47-rS8" secondAttribute="leading" id="Rs4-Pl-R8X"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="leading" secondItem="bRc-5e-QAH" secondAttribute="trailing" id="SO9-U6-cVO"/>
<constraint firstAttribute="bottom" secondItem="N3w-qP-kRZ" secondAttribute="bottom" id="STf-aE-Y2E"/>
<constraint firstAttribute="bottom" secondItem="kwc-0w-V51" secondAttribute="bottom" constant="10" id="SWG-oy-aZJ"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="TAb-IV-m7A"/>
<constraint firstAttribute="bottom" secondItem="cPl-47-rS8" secondAttribute="bottom" id="Tmp-md-564"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="height" secondItem="UjQ-Cw-7wH" secondAttribute="height" id="Uli-Qb-6Om"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="VcV-kz-XBb"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="6iC-Cl-RyI" secondAttribute="width" id="X0k-jG-o63"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="leading" secondItem="eTo-Ip-reh" secondAttribute="trailing" id="cOc-P1-ZhU"/>
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="dSr-cr-ebR"/>
<constraint firstItem="EiN-2p-Oig" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="fgT-6k-CaP"/>
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="Wjb-tu-QEo" secondAttribute="trailing" id="gNl-wJ-ujY"/>
<constraint firstItem="ZAg-Me-yKR" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="glN-lT-q1z"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="width" secondItem="Wjb-tu-QEo" secondAttribute="width" id="hEH-9C-pGZ"/>
<constraint firstItem="EiN-2p-Oig" firstAttribute="height" secondItem="kwc-0w-V51" secondAttribute="height" id="hOI-fd-H7m"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="i5C-wG-rRN"/>
<constraint firstItem="eTo-Ip-reh" firstAttribute="trailing" secondItem="dHj-rj-mjh" secondAttribute="leading" id="jsw-H6-2gQ"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="lQE-r9-9JT"/>
<constraint firstAttribute="bottom" secondItem="L7g-lu-boa" secondAttribute="bottom" constant="10" id="lv1-xB-0zR"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="N3w-qP-kRZ" secondAttribute="trailing" id="oQe-Qf-9ZO"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="pn7-s8-fDj"/>
<constraint firstItem="EiN-2p-Oig" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" id="qIf-aB-2ZY"/>
<constraint firstItem="6iC-Cl-RyI" firstAttribute="leading" secondItem="EiN-2p-Oig" secondAttribute="trailing" id="sAE-Nl-Puc"/>
<constraint firstItem="LNf-b4-GYP" firstAttribute="leading" secondItem="L7g-lu-boa" secondAttribute="trailing" id="t1q-Nc-vbg"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" constant="10" id="tVL-uj-6Ma"/>
<constraint firstItem="Wjb-tu-QEo" firstAttribute="trailing" secondItem="L7g-lu-boa" secondAttribute="leading" id="u3Q-pF-E3A"/>
<constraint firstAttribute="bottom" secondItem="Wjb-tu-QEo" secondAttribute="bottom" id="uh4-LM-Ieo"/>
<constraint firstItem="kwc-0w-V51" firstAttribute="leading" secondItem="cPl-47-rS8" secondAttribute="trailing" constant="25" id="vrx-0B-GOB"/>
<constraint firstAttribute="bottom" secondItem="eTo-Ip-reh" secondAttribute="bottom" id="xIu-Vy-Nff"/>
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="UjQ-Cw-7wH" secondAttribute="trailing" id="xWy-Uf-QEm"/>
<constraint firstItem="N3w-qP-kRZ" firstAttribute="leading" secondItem="ZAg-Me-yKR" secondAttribute="trailing" id="xsx-BM-yQ5"/>
<constraint firstItem="N3w-qP-kRZ" firstAttribute="top" secondItem="Yr6-3E-keb" secondAttribute="top" id="yEX-Wv-CZQ"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="67F-sV-r6W"/>
<exclude reference="xWy-Uf-QEm"/>
<exclude reference="1pQ-h0-SEG"/>
<exclude reference="HQ2-jA-X9g"/>
<exclude reference="OYQ-8o-3j8"/>
<exclude reference="Rs4-Pl-R8X"/>
<exclude reference="SWG-oy-aZJ"/>
<exclude reference="TAb-IV-m7A"/>
<exclude reference="Uli-Qb-6Om"/>
<exclude reference="lQE-r9-9JT"/>
<exclude reference="vrx-0B-GOB"/>
<exclude reference="KQe-Ei-8jY"/>
<exclude reference="sAE-Nl-Puc"/>
<exclude reference="7Um-cV-f7p"/>
<exclude reference="hOI-fd-H7m"/>
<exclude reference="2UA-Ao-KZF"/>
<exclude reference="SO9-U6-cVO"/>
<exclude reference="6ZX-Ub-2vw"/>
<exclude reference="cOc-P1-ZhU"/>
<exclude reference="4dj-Xx-ksP"/>
<exclude reference="DYn-Cd-g5H"/>
<exclude reference="dSr-cr-ebR"/>
<exclude reference="t1q-Nc-vbg"/>
</mask>
</variation>
</tableViewCellContentView>
<connections>
<outlet property="fridayButton" destination="Wjb-tu-QEo" id="AcP-Qg-i9P"/>
<outlet property="mondayButton" destination="N3w-qP-kRZ" id="u3A-mt-EKd"/>
<outlet property="saturdayButton" destination="LNf-b4-GYP" id="TeM-3b-B1Z"/>
<outlet property="sundayButton" destination="ZAg-Me-yKR" id="GUI-ry-Hm1"/>
<outlet property="thursdayButton" destination="eTo-Ip-reh" id="Dxi-hi-oBK"/>
<outlet property="tuesdayButton" destination="cPl-47-rS8" id="wIn-mO-cUx"/>
<outlet property="wednesdayButton" destination="6iC-Cl-RyI" id="GQe-Oy-pcd"/>
</connections>
<point key="canvasLocation" x="296" y="222"/>
</tableViewCell>
</objects>
</document>
@@ -1,193 +0,0 @@
//
// ExamplesFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "InputsFormViewController.h"
#import "SelectorsFormViewController.h"
#import "OthersFormViewController.h"
#import "DatesFormViewController.h"
#import "MultiValuedFormViewController.h"
#import "ExamplesFormViewController.h"
#import "NativeEventFormViewController.h"
#import "UICustomizationFormViewController.h"
#import "CustomRowsViewController.h"
#import "AccessoryViewFormViewController.h"
#import "PredicateFormViewController.h"
NSString * const kTextFieldAndTextView = @"TextFieldAndTextView";
NSString * const kSelectors = @"Selectors";
NSString * const kOthes = @"Others";
NSString * const kDates = @"Dates";
NSString * const kPredicates = @"BasicPredicates";
NSString * const kBlogExample = @"BlogPredicates";
NSString * const kMultivalued = @"Multivalued";
NSString * const kMultivaluedOnlyReorder = @"MultivaluedOnlyReorder";
NSString * const kMultivaluedOnlyInsert = @"MultivaluedOnlyInsert";
NSString * const kMultivaluedOnlyDelete = @"MultivaluedOnlyDelete";
NSString * const kValidations= @"Validations";
@interface ExamplesFormViewController ()
@end
@implementation ExamplesFormViewController
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
[self initializeForm];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self){
[self initializeForm];
}
return self;
}
#pragma mark - Helper
-(void)initializeForm
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptor];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Real examples"];
[form addFormSection:section];
// NativeEventFormViewController
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"realExamples" rowType:XLFormRowDescriptorTypeButton title:@"iOS Calendar Event Form"];
row.action.formSegueIdenfifier = @"NativeEventNavigationViewControllerSegue";
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"This form is actually an example"];
section.footerTitle = @"ExamplesFormViewController.h, Select an option to view another example";
[form addFormSection:section];
// TextFieldAndTextView
row = [XLFormRowDescriptor formRowDescriptorWithTag:kTextFieldAndTextView rowType:XLFormRowDescriptorTypeButton title:@"Text Fields"];
row.action.viewControllerClass = [InputsFormViewController class];
[section addFormRow:row];
// Selectors
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectors rowType:XLFormRowDescriptorTypeButton title:@"Selectors"];
row.action.formSegueIdenfifier = @"SelectorsFormViewControllerSegue";
[section addFormRow:row];
// Dates
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDates rowType:XLFormRowDescriptorTypeButton title:@"Date & Time"];
row.action.viewControllerClass = [DatesFormViewController class];
[section addFormRow:row];
// Others
row = [XLFormRowDescriptor formRowDescriptorWithTag:kOthes rowType:XLFormRowDescriptorTypeButton title:@"Other Rows"];
row.action.formSegueIdenfifier = @"OthersFormViewControllerSegue";
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued example"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Sections"];
row.action.viewControllerClass = [MultivaluedFormViewController class];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyReorder rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Reorder"];
row.action.viewControllerClass = [MultivaluedOnlyReorderViewController class];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyInsert rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Insert"];
row.action.viewControllerClass = [MultivaluedOnlyInserViewController class];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivaluedOnlyDelete rowType:XLFormRowDescriptorTypeButton title:@"Multivalued Only Delete"];
row.action.viewControllerClass = [MultivaluedOnlyDeleteViewController class];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"UI Customization"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"UI Customization"];
row.action.viewControllerClass = [UICustomizationFormViewController class];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Custom Rows"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Custom Rows"];
row.action.viewControllerClass = [CustomRowsViewController class];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Accessory View"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultivalued rowType:XLFormRowDescriptorTypeButton title:@"Accessory Views"];
row.action.viewControllerClass = [AccessoryViewFormViewController class];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Examples"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidations rowType:XLFormRowDescriptorTypeButton title:@"Validation Examples"];
row.action.formSegueIdenfifier = @"ValidationExamplesFormViewControllerSegue";
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Using Predicates"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Very basic predicates"];
row.action.formSegueIdenfifier = @"BasicPredicateViewControllerSegue";
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Blog Example Hide predicates"];
row.action.formSegueIdenfifier = @"BlogExampleViewSegue";
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Another example"];
row.action.formSegueIdenfifier = @"PredicateFormViewControllerSegue";
[section addFormRow:row];
self.form = form;
}
@end
@@ -1,152 +0,0 @@
//
// InputsFormViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class InputsFormViewController : XLFormViewController {
private struct Tags {
static let Name = "name"
static let Email = "email"
static let Twitter = "twitter"
static let Number = "number"
static let Integer = "integer"
static let Decimal = "decimal"
static let Password = "password"
static let Phone = "phone"
static let Url = "url"
static let ZipCode = "zipCode"
static let TextView = "textView"
static let Notes = "notes"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Text Fields")
form.assignFirstResponderOnShow = true
section = XLFormSectionDescriptor.formSectionWithTitle("TextField Types")
section.footerTitle = "This is a long text that will appear on section footer"
form.addFormSection(section)
// Name
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title: "Name")
row.required = true
section.addFormRow(row)
// Email
row = XLFormRowDescriptor(tag: Tags.Email, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
// validate the email
row.addValidator(XLFormValidator.emailValidator())
section.addFormRow(row)
// Twitter
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
row.disabled = NSNumber(bool: true)
row.value = "@no_editable"
section.addFormRow(row)
// Zip Code
row = XLFormRowDescriptor(tag: Tags.ZipCode, rowType: XLFormRowDescriptorTypeZipCode, title: "Zip Code")
section.addFormRow(row)
// Number
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeNumber, title: "Number")
section.addFormRow(row)
// Integer
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title: "Integer")
section.addFormRow(row)
// Decimal
row = XLFormRowDescriptor(tag: Tags.Decimal, rowType: XLFormRowDescriptorTypeDecimal, title: "Decimal")
section.addFormRow(row)
// Password
row = XLFormRowDescriptor(tag: Tags.Password, rowType: XLFormRowDescriptorTypePassword, title: "Password")
section.addFormRow(row)
// Phone
row = XLFormRowDescriptor(tag: Tags.Phone, rowType: XLFormRowDescriptorTypePhone, title: "Phone")
section.addFormRow(row)
// Url
row = XLFormRowDescriptor(tag: Tags.Url, rowType: XLFormRowDescriptorTypeURL, title: "Url")
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection()
form.addFormSection(section)
// TextView
row = XLFormRowDescriptor(tag: Tags.TextView, rowType: XLFormRowDescriptorTypeTextView)
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("TextView With Label Example")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeTextView, title: "Notes")
section.addFormRow(row)
self.form = form
}
override func viewDidLoad()
{
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "savePressed:")
}
func savePressed(button: UIBarButtonItem)
{
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
if (validationErrors.count > 0){
self.showFormValidationError(validationErrors.first)
return
}
self.tableView.endEditing(true)
let alertView = UIAlertView(title: "Valid Form", message: "No errors found", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
}
@@ -1,278 +0,0 @@
//
// MultiValuedFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "SelectorsFormViewController.h"
#import "MultiValuedFormViewController.h"
@implementation MultivaluedFormViewController
- (id)init
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Examples"];
// Multivalued section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued TextField"
sectionOptions:XLFormSectionOptionCanReorder | XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete
sectionInsertMode:XLFormSectionInsertModeButton];
section.multivaluedAddButton.title = @"Add New Tag";
section.footerTitle = @"XLFormSectionInsertModeButton sectionType adds a 'Add Item' (Add New Tag) button row as last cell.";
// set up the row template
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeName];
[[row cellConfig] setObject:@"Tag Name" forKey:@"textField.placeholder"];
section.multivaluedRowTemplate = row;
[form addFormSection:section];
// Another Multivalued section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued ActionSheet Selector example"
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
section.footerTitle = @"XLFormSectionInsertModeLastRow sectionType adds a '+' icon inside last table view cell allowing us to add a new row.";
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Tap to select.."];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5"];
[section addFormRow:row];
// Another one
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued Push Selector example"
sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete | XLFormSectionOptionCanReorder
sectionInsertMode:XLFormSectionInsertModeButton];
section.footerTitle = @"MultivaluedFormViewController.h";
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
section.multivaluedRowTemplate = [row copy];
[section addFormRow:row];
return [super initWithForm:form];
}
-(void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(addDidTouch:)];
}
#pragma mark - Actions
-(void)addDidTouch:(UIBarButtonItem * __unused)sender
{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Remove Last Section" otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
[actionSheet showInView:self.view];
}
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if ([actionSheet destructiveButtonIndex] == buttonIndex){
if (self.form.formSections.count > 0){
// remove last section
[self.form removeFormSectionAtIndex:(self.form.formSections.count - 1)];
}
}
else if ([[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:@"Add a section at the end"]){
// add a new section
XLFormSectionDescriptor * newSection = [XLFormSectionDescriptor formSectionWithTitle:[NSString stringWithFormat:@"Section created at %@", [NSDateFormatter localizedStringFromDate:[NSDate new] dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]] sectionOptions:XLFormSectionOptionCanInsert | XLFormSectionOptionCanDelete];
newSection.multivaluedTag = [NSString stringWithFormat:@"multivaluedPushSelector_%@", @(self.form.formSections.count)];
XLFormRowDescriptor * newRow = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPush title:@"Tap to select ;).."];
newRow.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3"];
[newSection addFormRow:newRow];
[self.form addFormSection:newSection];
}
else {
self.form.disabled = !self.form.disabled;
[self.tableView endEditing:YES];
[self.tableView reloadData];
}
}
@end
@implementation MultivaluedOnlyReorderViewController
- (id)init
{
NSTimeInterval secondsPerDay = 24 * 60 * 60;
NSArray * list = @[@"Today", @"Yesterday", @"Before Yesterday"];
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
form = [XLFormDescriptor formDescriptorWithTitle:@"Only Reorder Examples"];
// Multivalued Section with inline rows - section set up to support only reordering
section = [XLFormSectionDescriptor formSectionWithTitle:@"Reordering Inline Rows"
sectionOptions:XLFormSectionOptionCanReorder];
section.footerTitle = @"XLFormRowDescriptorTypeDateInline row type";
[form addFormSection:section];
[list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeDateInline];
row.value = [NSDate dateWithTimeIntervalSinceNow:(-secondsPerDay * idx)];
row.title = obj;
[section addFormRow:row];
}];
// Multivalued Section with common rows - section set up to support only reordering
section = [XLFormSectionDescriptor formSectionWithTitle:@"Reordering Rows"
sectionOptions:XLFormSectionOptionCanReorder];
section.footerTitle = @"XLFormRowDescriptorTypeInfo row type";
[form addFormSection:section];
[list enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeInfo];
row.value = [NSDateFormatter localizedStringFromDate:[NSDate dateWithTimeIntervalSinceNow:(-secondsPerDay * idx)] dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
row.title = obj;
[section addFormRow:row];
}];
return [super initWithForm:form];
}
@end
@implementation MultivaluedOnlyInserViewController
- (id)init
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
form = [XLFormDescriptor formDescriptorWithTitle:@"Multivalued Only Insert"];
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeButton"
sectionOptions:XLFormSectionOptionCanInsert
sectionInsertMode:XLFormSectionInsertModeButton];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
section.multivaluedRowTemplate = row;
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeButton With Inline Cells"
sectionOptions:XLFormSectionOptionCanInsert
sectionInsertMode:XLFormSectionInsertModeButton];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeDateInline];
row.value = [NSDate new];
row.title = @"Date";
section.multivaluedRowTemplate = row;
section = [XLFormSectionDescriptor formSectionWithTitle:@"XLFormSectionInsertModeLastRow"
sectionOptions:XLFormSectionOptionCanInsert
sectionInsertMode:XLFormSectionInsertModeLastRow];
[form addFormSection:section];
for (NSString * tag in nameList) {
// add a row to the section, the row will be used to crete new rows.
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
row.value = tag;
[section addFormRow:row];
}
return [super initWithForm:form];
}
@end
@implementation MultivaluedOnlyDeleteViewController
- (id)init
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
NSArray * nameList = @[@"family", @"male", @"female", @"client"];
form = [XLFormDescriptor formDescriptor];
// MultivaluedSection section
section = [XLFormSectionDescriptor formSectionWithTitle:@""
sectionOptions:XLFormSectionOptionCanDelete];
section.footerTitle = @"you can swipe to delete when table.editing = NO (Not Editing)";
[form addFormSection:section];
for (NSString * tag in nameList) {
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
[[row cellConfig] setObject:@"Add a new tag" forKey:@"textField.placeholder"];
row.value = [tag copy];
[section addFormRow:row];
}
// Multivalued Section with inline row.
section = [XLFormSectionDescriptor formSectionWithTitle:@""
sectionOptions:XLFormSectionOptionCanDelete];
section.footerTitle = @"you can swipe to delete when table.editing = NO (Not Editing)";
[form addFormSection:section];
for (NSUInteger i = 0; i < 4; i++) {
row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeSelectorPickerViewInline];
row.title = @"Tap to select";
row.value = @"client";
row.selectorOptions = nameList;
[section addFormRow:row];
}
return [super initWithForm:form];
}
-(void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Editing" style:UIBarButtonItemStylePlain target:self action:@selector(toggleEditing:)];
}
-(void)toggleEditing:(UIBarButtonItem *)barButtonItem
{
[self.tableView setEditing:!self.tableView.editing animated:YES];
[barButtonItem setTitle:(self.tableView.editing ? @"Editing" : @"Not Editing")];
}
@end
@@ -1,60 +0,0 @@
//
// XLFormCustomCell.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLFormCustomCell.h"
@implementation XLFormCustomCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)configure
{
[super configure];
//override
}
- (void)update
{
[super update];
// override
self.textLabel.text = @"Am a custom cell, select me!";
}
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
{
// custom code here
// i.e new behaviour when cell has been selected
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...";
self.rowDescriptor.value = self.textLabel.text;
[self.formViewController.tableView selectRowAtIndexPath:nil animated:YES scrollPosition:UITableViewScrollPositionNone];
}
@end
@@ -1,188 +0,0 @@
//
// OthersFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "MapViewController.h"
#import "OthersFormViewController.h"
NSString *const kSwitchBool = @"switchBool";
NSString *const kSwitchCheck = @"switchBool";
NSString *const kStepCounter = @"stepCounter";
NSString *const kSlider = @"slider";
NSString *const kSegmentedControl = @"segmentedControl";
NSString *const kCustom = @"custom";
NSString *const kInfo = @"info";
NSString *const kButton = @"button";
NSString *const kButtonLeftAligned = @"buttonLeftAligned";
NSString *const kButtonWithSegueId = @"buttonWithSegueId";
NSString *const kButtonWithSegueClass = @"buttonWithSegueClass";
NSString *const kButtonWithNibName = @"buttonWithNibName";
NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
@implementation OthersFormViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
}
return self;
}
- (id)init
{
self = [super init];
if (self){
[self initializeForm];
}
return self;
}
-(void)initializeForm
{
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Other Cells"];
XLFormSectionDescriptor * section;
// Basic Information
section = [XLFormSectionDescriptor formSectionWithTitle:@"Other Cells"];
section.footerTitle = @"OthersFormViewController.h";
[form addFormSection:section];
// Switch
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchBool rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Switch"]];
// check
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"]];
// step counter
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"]];
// Segmented Control
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
row.selectorOptions = @[@"Apple", @"Orange", @"Pear"];
row.value = @"Pear";
[section addFormRow:row];
// Slider
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSlider rowType:XLFormRowDescriptorTypeSlider title:@"Slider"];
row.value = @(30);
[row.cellConfigAtConfigure setObject:@(100) forKey:@"slider.maximumValue"];
[row.cellConfigAtConfigure setObject:@(10) forKey:@"slider.minimumValue"];
[row.cellConfigAtConfigure setObject:@(4) forKey:@"steps"];
[section addFormRow:row];
// Info cell
XLFormRowDescriptor *infoRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kInfo rowType:XLFormRowDescriptorTypeInfo];
infoRowDescriptor.title = @"Version";
infoRowDescriptor.value = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[section addFormRow:infoRowDescriptor];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Buttons"];
section.footerTitle = @"Blue buttons will show a message when Switch is ON";
[form addFormSection:section];
// Button
XLFormRowDescriptor * buttonRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButton rowType:XLFormRowDescriptorTypeButton title:@"Button"];
[buttonRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
buttonRow.action.formSelector = @selector(didTouchButton:);
[section addFormRow:buttonRow];
// Left Button
XLFormRowDescriptor * buttonLeftAlignedRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonLeftAligned rowType:XLFormRowDescriptorTypeButton title:@"Button with Block"];
[buttonLeftAlignedRow.cellConfig setObject:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forKey:@"textLabel.textColor"];
[buttonLeftAlignedRow.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
[buttonLeftAlignedRow.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
buttonLeftAlignedRow.action.formBlock = ^(XLFormRowDescriptor * sender){
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alertView show];
}
[self deselectFormRow:sender];
};
[section addFormRow:buttonLeftAlignedRow];
// Another Left Button with segue
XLFormRowDescriptor * buttonLeftAlignedWithSegueRow = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Class"];
buttonLeftAlignedWithSegueRow.action.formSegueClass = NSClassFromString(@"UIStoryboardPushSegue");
buttonLeftAlignedWithSegueRow.action.viewControllerClass = [MapViewController class];
[section addFormRow:buttonLeftAlignedWithSegueRow];
// Button with SegueId
XLFormRowDescriptor * buttonWithSegueId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Idenfifier"];
buttonWithSegueId.action.formSegueIdenfifier = @"MapViewControllerSegue";
[section addFormRow:buttonWithSegueId];
// Another Button using Segue
XLFormRowDescriptor * buttonWithStoryboardId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithStoryboardId rowType:XLFormRowDescriptorTypeButton title:@"Button with StoryboardId"];
buttonWithStoryboardId.action.viewControllerStoryboardId = @"MapViewController";
[section addFormRow:buttonWithStoryboardId];
// Another Left Button with segue
XLFormRowDescriptor * buttonWithNibName = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithNibName
rowType:XLFormRowDescriptorTypeButton
title:@"Button with NibName"];
buttonWithNibName.action.viewControllerNibName = @"MapViewController";
[section addFormRow:buttonWithNibName];
self.form = form;
}
-(void)didTouchButton:(XLFormRowDescriptor *)sender
{
if ([[sender.sectionDescriptor.formDescriptor formRowWithTag:kSwitchBool].value boolValue]){
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil) message:@"Button has checked the switch value..." delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alertView show];
}
[self deselectFormRow:sender];
}
-(void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithTitle:@"Disable" style:UIBarButtonItemStylePlain
target:self
action:@selector(disableEnable:)];
barButton.possibleTitles = [NSSet setWithObjects:@"Disable", @"Enable", nil];
self.navigationItem.rightBarButtonItem = barButton;
}
-(void)disableEnable:(UIBarButtonItem *)button
{
self.form.disabled = !self.form.disabled;
[button setTitle:(self.form.disabled ? @"Enable" : @"Disable")];
[self.tableView endEditing:YES];
[self.tableView reloadData];
}
@end
@@ -1,84 +0,0 @@
//
// BasicPredicateViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "BasicPredicateViewController.h"
NSString *const khiderow = @"tag1";
NSString *const khidesection = @"tag2";
NSString *const ktext = @"tag3";
@implementation BasicPredicateViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initializeForm];
}
return self;
}
- (void)initializeForm
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Basic Predicates"];
section = [XLFormSectionDescriptor formSectionWithTitle:@"A Section"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:khiderow rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Show next row"];
row.value = @0;
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:khidesection rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Show B Section"];
row.hidden = [NSString stringWithFormat:@"$%@==0", khiderow];
row.value = @0;
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"B Section"];
section.footerTitle = @"BasicPredicateViewController";
section.hidden = [NSString stringWithFormat:@"$%@==0", khidesection];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:ktext rowType:XLFormRowDescriptorTypeText title:@""];
[row.cellConfigAtConfigure setObject:@"Gonna disappear soon!!" forKey:@"textField.placeholder"];
[section addFormRow:row];
self.form = form;
}
@end
@@ -1,89 +0,0 @@
//
// BlogExampleViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class BlogExampleViewController : XLFormViewController {
private struct Tags {
static let Hobbies = "hobbies"
static let Sport = "sport"
static let Film = "films1"
static let Film2 = "films2"
static let Music = "music"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Blog Example: Hobbies")
section = XLFormSectionDescriptor()
section.title = "Hobbies"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Hobbies, rowType: XLFormRowDescriptorTypeMultipleSelector, title:"Select Hobbies")
row.selectorOptions = ["Sport", "Music", "Films"]
row.value = []
section.addFormRow(row)
section = XLFormSectionDescriptor()
section.title = "Some more questions"
section.hidden = NSPredicate(format: "$\(row.description).value.@count == 0")
section.footerTitle = "BlogExampleViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Sport, rowType: XLFormRowDescriptorTypeTextView, title:"Your favourite sportsman?")
row.hidden = "NOT $\(Tags.Hobbies).value contains 'Sport'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Film, rowType:XLFormRowDescriptorTypeTextView, title: "Your favourite film?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Film2, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite actor?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Music, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite singer?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Music'"
section.addFormRow(row)
self.form = form
}
}
@@ -1,121 +0,0 @@
//
// PredicateFormViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class PredicateFormViewController : XLFormViewController {
private struct Tags {
static let Text = "text"
static let Integer = "integer"
static let Switch = "switch"
static let Date = "date"
static let Account = "account"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Predicates example")
section = XLFormSectionDescriptor()
section.title = "Independent rows"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Text, rowType: XLFormRowDescriptorTypeAccount, title:"Text")
row.cellConfigAtConfigure["textField.placeholder"] = "Type disable"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title:"Integer")
row.hidden = NSPredicate(format: "$\(Tags.Switch).value==0")
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Switch, rowType: XLFormRowDescriptorTypeBooleanSwitch, title:"Boolean")
row.value = true
section.addFormRow(row)
form.addFormSection(section)
section = XLFormSectionDescriptor()
section.title = "Dependent section"
section.footerTitle = "Type disable in the textfield, a number between 18 and 60 in the integer field or use the switch to disable the last row. By doing all three the last section will hide.\nThe integer field hides when the boolean switch is set to 0."
form.addFormSection(section)
// Predicate Disabling
row = XLFormRowDescriptor(tag: Tags.Date, rowType: XLFormRowDescriptorTypeDateInline, title:"Disabled")
row.value = NSDate()
section.addFormRow(row)
row.disabled = NSPredicate(format: "$\(Tags.Text).value contains[c] 'disable' OR ($\(Tags.Integer).value between {18, 60}) OR ($\(Tags.Switch).value == 0)")
section.hidden = NSPredicate(format: "($\(Tags.Text).value contains[c] 'disable') AND ($\(Tags.Integer).value between {18, 60}) AND ($\(Tags.Switch).value == 0)")
section = XLFormSectionDescriptor()
section.title = "More predicates..."
section.footerTitle = "This row hides when the row of the previous section is disabled and the textfield in the first section contains \"out\"\n\nPredicateFormViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: "thirds", rowType:XLFormRowDescriptorTypeAccount, title:"Account")
section.addFormRow(row)
row.hidden = NSPredicate(format: "$\(Tags.Date).isDisabled == 1 AND $\(Tags.Text).value contains[c] 'Out'")
row.onChangeBlock = { [weak self] oldValue, newValue, _ in
let noValue = "No Value"
let message = "Old value: \(oldValue ?? noValue), New value: \(newValue ?? noValue)"
let alertView = UIAlertController(title: "Account Field changed", message: message, preferredStyle: .ActionSheet)
alertView.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
self?.navigationController?.presentViewController(alertView, animated: true, completion: nil)
}
self.form = form
}
}
@@ -1,263 +0,0 @@
//
// NativeEventNavigationViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "DateAndTimeValueTrasformer.h"
#import "NativeEventFormViewController.h"
@implementation NativeEventNavigationViewController
-(id)init
{
self = [super initWithRootViewController:[[NativeEventFormViewController alloc] init]];
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
[self.view setTintColor:[UIColor redColor]];
}
@end
@interface NativeEventFormViewController ()
@end
@implementation NativeEventFormViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initializeForm];
}
return self;
}
- (void)initializeForm
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Add Event"];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Title
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"Title" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
row.required = YES;
[section addFormRow:row];
// Location
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"location" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Location" forKey:@"textField.placeholder"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// All-day
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"all-day" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"All-day"];
[section addFormRow:row];
// Starts
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"starts" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Starts"];
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*24];
[section addFormRow:row];
// Ends
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"ends" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Ends"];
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*25];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Repeat
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"repeat" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Repeat"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Never"];
row.selectorTitle = @"Repeat";
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Never"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Every Day"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Every Week"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Every 2 Weeks"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Every Month"],
[XLFormOptionsObject formOptionsObjectWithValue:@(5) displayText:@"Every Year"],
];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Alert
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"alert" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Alert"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"None"];
row.selectorTitle = @"Event Alert";
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"None"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"At time of event"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"5 minutes before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"15 minutes before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"30 minutes before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(5) displayText:@"1 hour before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(6) displayText:@"2 hours before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(7) displayText:@"1 day before"],
[XLFormOptionsObject formOptionsObjectWithValue:@(8) displayText:@"2 days before"],
];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Show As
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"showAs" rowType:XLFormRowDescriptorTypeSelectorPush title:@"Show As"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Busy"];
row.selectorTitle = @"Show As";
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Busy"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Free"]];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// URL
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"url" rowType:XLFormRowDescriptorTypeURL];
[row.cellConfigAtConfigure setObject:@"URL" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Notes
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"notes" rowType:XLFormRowDescriptorTypeTextView];
[row.cellConfigAtConfigure setObject:@"Notes" forKey:@"textView.placeholder"];
[section addFormRow:row];
self.form = form;
}
-(void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelPressed:)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(savePressed:)];
}
#pragma mark - XLFormDescriptorDelegate
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
{
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
if ([rowDescriptor.tag isEqualToString:@"alert"]){
if ([[rowDescriptor.value valueData] isEqualToNumber:@(0)] == NO && [[oldValue valueData] isEqualToNumber:@(0)]){
XLFormRowDescriptor * newRow = [rowDescriptor copy];
newRow.tag = @"secondAlert";
newRow.title = @"Second Alert";
[self.form addFormRow:newRow afterRow:rowDescriptor];
}
else if ([[oldValue valueData] isEqualToNumber:@(0)] == NO && [[newValue valueData] isEqualToNumber:@(0)]){
[self.form removeFormRowWithTag:@"secondAlert"];
}
}
else if ([rowDescriptor.tag isEqualToString:@"all-day"]){
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
XLFormDateCell * dateStartCell = (XLFormDateCell *)[[self.form formRowWithTag:@"starts"] cellForFormController:self];
XLFormDateCell * dateEndCell = (XLFormDateCell *)[[self.form formRowWithTag:@"ends"] cellForFormController:self];
if ([[rowDescriptor.value valueData] boolValue] == YES){
startDateDescriptor.valueTransformer = [DateValueTrasformer class];
endDateDescriptor.valueTransformer = [DateValueTrasformer class];
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDate];
}
else{
startDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
endDateDescriptor.valueTransformer = [DateTimeValueTrasformer class];
[dateStartCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
[dateEndCell setFormDatePickerMode:XLFormDateDatePickerModeDateTime];
}
[dateStartCell update];
[dateEndCell update];
}
else if ([rowDescriptor.tag isEqualToString:@"starts"]){
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
// startDateDescriptor is later than endDateDescriptor
endDateDescriptor.value = [[NSDate alloc] initWithTimeInterval:(60*60*24) sinceDate:startDateDescriptor.value];
[dateEndCell update];
}
}
else if ([rowDescriptor.tag isEqualToString:@"ends"]){
XLFormRowDescriptor * startDateDescriptor = [self.form formRowWithTag:@"starts"];
XLFormRowDescriptor * endDateDescriptor = [self.form formRowWithTag:@"ends"];
XLFormDateCell * dateEndCell = (XLFormDateCell *)[endDateDescriptor cellForFormController:self];
if ([startDateDescriptor.value compare:endDateDescriptor.value] == NSOrderedDescending) {
// startDateDescriptor is later than endDateDescriptor
NSDictionary *strikeThroughAttribute = [NSDictionary dictionaryWithObject:@1
forKey:NSStrikethroughStyleAttributeName];
NSAttributedString* strikeThroughText = [[NSAttributedString alloc] initWithString:dateEndCell.detailTextLabel.text attributes:strikeThroughAttribute];
dateEndCell.detailTextLabel.attributedText = strikeThroughText;
}
}
}
-(void)cancelPressed:(UIBarButtonItem * __unused)button
{
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)savePressed:(UIBarButtonItem * __unused)button
{
NSArray * validationErrors = [self formValidationErrors];
if (validationErrors.count > 0){
[self showFormValidationError:[validationErrors firstObject]];
return;
}
[self.tableView endEditing:YES];
}
@end
@@ -1,13 +0,0 @@
//
// UIFormViewCotroller+NativeEvetFormViewController.m
// XLForm
//
// Created by Martin Barreto on 4/2/14.
// Copyright (c) 2014 Xmartlabs. All rights reserved.
//
#import "UIFormViewCotroller+NativeEvetFormViewController.h"
@implementation UIFormViewCotroller (NativeEvetFormViewController)
@end
@@ -1,73 +0,0 @@
//
// CustomSelectorsFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <MapKit/MapKit.h>
#import "CLLocationValueTrasformer.h"
#import "MapViewController.h"
#import "CustomSelectorsFormViewController.h"
NSString *const kSelectorMap = @"selectorMap";
NSString *const kSelectorMapPopover = @"selectorMapPopover";
@implementation CustomSelectorsFormViewController
-(id)init
{
self = [super init];
if (self) {
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Custom Selectors"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Basic Information
section = [XLFormSectionDescriptor formSection];
section.footerTitle = @"CustomSelectorsFormViewController.h";
[form addFormSection:section];
// Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorMap rowType:XLFormRowDescriptorTypeSelectorPush title:@"Coordinate"];
row.action.viewControllerClass = [MapViewController class];
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
// Selector PopOver
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorMapPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"Coordinate PopOver"];
row.action.viewControllerClass = [MapViewController class];
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
}
self.form = form;
}
return self;
}
@end
@@ -1,48 +0,0 @@
//
// CLLocationValueTrasformer.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <MapKit/MapKit.h>
#import "CLLocationValueTrasformer.h"
@implementation CLLocationValueTrasformer
+ (Class)transformedValueClass
{
return [NSString class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
if (!value) return nil;
CLLocation * location = (CLLocation *)value;
return [NSString stringWithFormat:@"%0.4f, %0.4f", location.coordinate.latitude, location.coordinate.longitude];
}
@end
@@ -1,108 +0,0 @@
//
// MapViewController.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UIView+XLFormAdditions.h"
#import <MapKit/MapKit.h>
#import "MapViewController.h"
@interface MapAnnotation : NSObject <MKAnnotation>
@end
@implementation MapAnnotation
@synthesize coordinate = _coordinate;
-(void)setCoordinate:(CLLocationCoordinate2D)newCoordinate
{
_coordinate = newCoordinate;
}
@end
@interface MapViewController () <MKMapViewDelegate>
@property (nonatomic) MKMapView * mapView;
@end
@implementation MapViewController
@synthesize rowDescriptor = _rowDescriptor;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view addSubview:self.mapView];
self.mapView.delegate = self;
if (self.rowDescriptor.value){
[self.mapView setCenterCoordinate:((CLLocation *)self.rowDescriptor.value).coordinate];
self.title = [NSString stringWithFormat:@"%0.4f, %0.4f", self.mapView.centerCoordinate.latitude, self.mapView.centerCoordinate.longitude];
MapAnnotation *annotation = [[MapAnnotation alloc] init];
annotation.coordinate = self.mapView.centerCoordinate;
[self.mapView addAnnotation:annotation];
}
}
-(MKMapView *)mapView
{
if (_mapView) return _mapView;
_mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
_mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
return _mapView;
}
#pragma mark - MKMapViewDelegate
- (MKAnnotationView *)mapView:(MKMapView *)mapView
viewForAnnotation:(id <MKAnnotation>)annotation {
MKPinAnnotationView *pinAnnotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:@"annotation"];
pinAnnotationView.pinColor = MKPinAnnotationColorRed;
pinAnnotationView.draggable = YES;
pinAnnotationView.animatesDrop = YES;
return pinAnnotationView;
}
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view didChangeDragState:(MKAnnotationViewDragState)newState
fromOldState:(MKAnnotationViewDragState)oldState
{
if (newState == MKAnnotationViewDragStateEnding){
self.rowDescriptor.value = [[CLLocation alloc] initWithLatitude:view.annotation.coordinate.latitude longitude:view.annotation.coordinate.longitude];
self.title = [NSString stringWithFormat:@"%0.4f, %0.4f", view.annotation.coordinate.latitude, view.annotation.coordinate.longitude];
}
}
@end
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MapViewController">
<connections>
<outlet property="view" destination="iN0-l3-epB" id="O5R-PM-tsI"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</objects>
</document>
@@ -1,66 +0,0 @@
//
// DynamicSelectorsFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UsersTableViewController.h"
#import "DynamicSelectorsFormViewController.h"
NSString *const kSelectorUser = @"selectorUser";
NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
@implementation DynamicSelectorsFormViewController
-(id)init
{
self = [super init];
if (self) {
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Selectors"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Basic Information
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dynamic Selectors"];
section.footerTitle = @"DynamicSelectorsFormViewController.h";
[form addFormSection:section];
// Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUser rowType:XLFormRowDescriptorTypeSelectorPush title:@"User"];
row.action.viewControllerClass = [UsersTableViewController class];
[section addFormRow:row];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
// Selector PopOver
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUserPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"User Popover"];
row.action.viewControllerClass = [UsersTableViewController class];
[section addFormRow:row];
}
self.form = form;
}
return self;
}
@end
@@ -1,210 +0,0 @@
//
// UsersTableViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class UserCell : UITableViewCell {
lazy var userImage : UIImageView = {
let tempUserImage = UIImageView()
tempUserImage.translatesAutoresizingMaskIntoConstraints = false
tempUserImage.layer.masksToBounds = true
tempUserImage.layer.cornerRadius = 10.0
return tempUserImage
}()
lazy var userName : UILabel = {
let tempUserName = UILabel()
tempUserName.translatesAutoresizingMaskIntoConstraints = false
tempUserName.font = UIFont.systemFontOfSize(15.0)
return tempUserName
}()
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// Initialization code
contentView.addSubview(userImage)
contentView.addSubview(userName)
contentView.addConstraints(layoutConstraints())
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
// MARK: - Layout Constraints
func layoutConstraints() -> [NSLayoutConstraint]{
let views = ["image": self.userImage, "name": self.userName ]
let metrics = [ "imgSize": 50.0, "margin": 12.0]
var result = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(margin)-[image(imgSize)]-[name]", options:.AlignAllTop, metrics: metrics, views: views)
result += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(margin)-[image(imgSize)]", options:NSLayoutFormatOptions(), metrics:metrics, views: views)
return result
}
}
private let _UsersJSONSerializationSharedInstance = UsersJSONSerialization()
class UsersJSONSerialization {
lazy var userData : Array<AnyObject>? = {
let dataString =
"[" +
"{\"id\":1,\"name\":\"Apu Nahasapeemapetilon\",\"imageName\":\"Apu_Nahasapeemapetilon.png\"}," +
"{\"id\":7,\"name\":\"Bart Simpsons\",\"imageName\":\"Bart_Simpsons.png\"}," +
"{\"id\":8,\"name\":\"Homer Simpsons\",\"imageName\":\"Homer_Simpsons.png\"}," +
"{\"id\":9,\"name\":\"Lisa Simpsons\",\"imageName\":\"Lisa_Simpsons.png\"}," +
"{\"id\":2,\"name\":\"Maggie Simpsons\",\"imageName\":\"Maggie_Simpsons.png\"}," +
"{\"id\":3,\"name\":\"Marge Simpsons\",\"imageName\":\"Marge_Simpsons.png\"}," +
"{\"id\":4,\"name\":\"Montgomery Burns\",\"imageName\":\"Montgomery_Burns.png\"}," +
"{\"id\":5,\"name\":\"Ned Flanders\",\"imageName\":\"Ned_Flanders.png\"}," +
"{\"id\":6,\"name\":\"Otto Mann\",\"imageName\":\"Otto_Mann.png\"}]"
let jsonData = dataString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)
do {
let result = try NSJSONSerialization.JSONObjectWithData(jsonData!, options: NSJSONReadingOptions()) as! Array<AnyObject>
return result
}
catch let error as NSError {
print("\(error)")
}
return nil
}()
class var sharedInstance: UsersJSONSerialization {
return _UsersJSONSerializationSharedInstance
}
}
class User: NSObject, XLFormOptionObject {
let userId: Int
let userName : String
let userImage: String
init(userId: Int, userName: String, userImage: String){
self.userId = userId
self.userImage = userImage
self.userName = userName
}
func formDisplayText() -> String {
return self.userName
}
func formValue() -> AnyObject {
return self.userId
}
}
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController {
var rowDescriptor : XLFormRowDescriptor?
var popoverController : UIPopoverController?
var userCell : UserCell?
private let kUserCellIdentifier = "UserCell"
override init(style: UITableViewStyle) {
super.init(style: style);
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.registerClass(UserCell.self, forCellReuseIdentifier: kUserCellIdentifier)
tableView.tableFooterView = UIView(frame: CGRect.zero)
}
// MARK: UITableViewDataSource
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return UsersJSONSerialization.sharedInstance.userData!.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UserCell = tableView.dequeueReusableCellWithIdentifier(self.kUserCellIdentifier, forIndexPath: indexPath) as! UserCell
let usersData = UsersJSONSerialization.sharedInstance.userData! as! Array<Dictionary<String, AnyObject>>
let userData = usersData[indexPath.row] as Dictionary<String, AnyObject>
let userId = userData["id"] as! Int
cell.userName.text = userData["name"] as? String
cell.userImage.image = UIImage(named: (userData["imageName"] as? String)!)
if let value = rowDescriptor?.value {
cell.accessoryType = value.formValue().isEqual(userId) ? .Checkmark : .None
}
return cell;
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 73.0
}
//MARK: UITableViewDelegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let usersData = UsersJSONSerialization.sharedInstance.userData! as! Array<Dictionary<String, AnyObject>>
let userData = usersData[indexPath.row] as Dictionary<String, AnyObject>
let user = User(userId: (userData["id"] as! Int), userName: userData["name"] as! String, userImage: userData["imageName"] as! String)
self.rowDescriptor!.value = user;
if let porpOver = self.popoverController {
porpOver.dismissPopoverAnimated(true)
porpOver.delegate?.popoverControllerDidDismissPopover!(porpOver)
}
else if parentViewController is UINavigationController {
navigationController?.popViewControllerAnimated(true)
}
}
}
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="5064" systemVersion="13C1021" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="User" representedClassName="User" syncable="YES">
<attribute name="userId" optional="YES" attributeType="Integer 32" defaultValueString="0" syncable="YES"/>
<attribute name="userImageURL" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="userName" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<elements>
<element name="User" positionX="-63" positionY="-18" width="128" height="88"/>
</elements>
</model>
@@ -1,53 +0,0 @@
//
// CoreDataStore.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <CoreData/CoreData.h>
#import <Foundation/Foundation.h>
@interface CoreDataStore : NSObject
+(id)defaultStore;
+ (NSManagedObjectContext *)mainQueueContext;
+ (NSManagedObjectContext *)privateQueueContext;
+ (void)savePrivateQueueContext;
+ (void)saveMainQueueContext;
+ (NSManagedObjectID *)managedObjectIDFromString:(NSString *)managedObjectIDString;
@end
@interface NSManagedObject (Additions)
+(instancetype)findFirstByAttribute:(NSString *)attribute withValue:(id)value inContext:(NSManagedObjectContext *)context;
+(NSFetchRequest*)fetchRequest;
+(instancetype)insert:(NSManagedObjectContext *)context;
@end
@@ -1,227 +0,0 @@
//
// CoreDataStore.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "CoreDataStore.h"
static NSString *const TBCoreDataModelFileName = @"Model";
@interface CoreDataStore ()
@property (strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (strong, nonatomic) NSManagedObjectContext *mainQueueContext;
@property (strong, nonatomic) NSManagedObjectContext *privateQueueContext;
@end
@implementation CoreDataStore
+ (instancetype)defaultStore {
static CoreDataStore *_defaultStore = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_defaultStore = [[self alloc] init];
});
return _defaultStore;
}
#pragma mark - Singleton Access
+ (NSManagedObjectContext *)mainQueueContext
{
return [[self defaultStore] mainQueueContext];
}
+ (NSManagedObjectContext *)privateQueueContext
{
return [[self defaultStore] privateQueueContext];
}
+(void)savePrivateQueueContext
{
NSError * error;
[[self privateQueueContext] save:&error];
NSAssert(!error, [error localizedDescription]);
}
+ (void)saveMainQueueContext
{
NSError * error;
[[self mainQueueContext] save:&error];
NSAssert(!error, [error localizedDescription]);
}
+ (NSManagedObjectID *)managedObjectIDFromString:(NSString *)managedObjectIDString
{
return [[[self defaultStore] persistentStoreCoordinator] managedObjectIDForURIRepresentation:[NSURL URLWithString:managedObjectIDString]];
}
#pragma mark - Lifecycle
- (id)init
{
self = [super init];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSavePrivateQueueContext:)name:NSManagedObjectContextDidSaveNotification object:[self privateQueueContext]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSaveMainQueueContext:) name:NSManagedObjectContextDidSaveNotification object:[self mainQueueContext]];
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Notifications
- (void)contextDidSavePrivateQueueContext:(NSNotification *)notification
{
@synchronized(self) {
[self.mainQueueContext performBlock:^{
for(NSManagedObject *object in [[notification userInfo] objectForKey:NSUpdatedObjectsKey]) {
[[self.mainQueueContext objectWithID:[object objectID]] willAccessValueForKey:nil];
}
[self.mainQueueContext mergeChangesFromContextDidSaveNotification:notification];
}];
}
}
- (void)contextDidSaveMainQueueContext:(NSNotification *)notification
{
@synchronized(self) {
[self.privateQueueContext performBlock:^{
[self.privateQueueContext mergeChangesFromContextDidSaveNotification:notification];
}];
}
}
#pragma mark - Getters
- (NSManagedObjectContext *)mainQueueContext
{
if (!_mainQueueContext) {
_mainQueueContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
_mainQueueContext.persistentStoreCoordinator = self.persistentStoreCoordinator;
}
return _mainQueueContext;
}
- (NSManagedObjectContext *)privateQueueContext
{
if (!_privateQueueContext) {
_privateQueueContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
_privateQueueContext.persistentStoreCoordinator = self.persistentStoreCoordinator;
}
return _privateQueueContext;
}
#pragma mark - Stack Setup
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (!_persistentStoreCoordinator) {
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel];
NSError *error = nil;
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self persistentStoreURL] options:[self persistentStoreOptions] error:&error]) {
NSLog(@"Error adding persistent store. %@, %@", error, error.userInfo);
}
}
return _persistentStoreCoordinator;
}
- (NSManagedObjectModel *)managedObjectModel
{
if (!_managedObjectModel) {
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:TBCoreDataModelFileName withExtension:@"momd"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
}
return _managedObjectModel;
}
- (NSURL *)persistentStoreURL
{
return [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Model.sqlite"];
}
- (NSDictionary *)persistentStoreOptions
{
return @{NSInferMappingModelAutomaticallyOption: @YES, NSMigratePersistentStoresAutomaticallyOption: @YES, NSSQLitePragmasOption: @{@"synchronous": @"OFF"}};
}
#pragma mark - Application's Documents directory
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
@end
@implementation NSManagedObject (Additions)
+(instancetype)findFirstByAttribute:(NSString *)attribute withValue:(id)value inContext:(NSManagedObjectContext *)context
{
NSString * predicateStr = [NSString stringWithFormat:@"%@ = %%@", attribute];
NSPredicate * searchByAttValue = [NSPredicate predicateWithFormat:predicateStr argumentArray:@[value]];
NSFetchRequest * fetchRequest = [self fetchRequest];
fetchRequest.predicate = searchByAttValue;
fetchRequest.fetchLimit = 1;
NSArray *result = [context executeFetchRequest:fetchRequest error:nil];
return [result lastObject];
}
+(NSFetchRequest*)fetchRequest
{
return [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass(self)];
}
+(NSEntityDescription*)entityDescriptor:(NSManagedObjectContext *)context
{
return [NSEntityDescription entityForName:NSStringFromClass(self) inManagedObjectContext:context];
}
+(instancetype)insert:(NSManagedObjectContext *)context
{
return [[NSManagedObject alloc] initWithEntity:[self entityDescriptor:context] insertIntoManagedObjectContext:context];
}
@end
@@ -1,41 +0,0 @@
//
// User+Additions.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "User.h"
@interface User (Additions) <XLFormOptionObject>
+ (User *)createOrUpdateWithServiceResult:(NSDictionary *)data inContext:(NSManagedObjectContext *)context;
+ (UIImage *)defaultProfileImage;
+ (NSPredicate *)getPredicateBySearchInput:(NSString *)search;
+ (NSFetchRequest *)getFetchRequest;
+ (NSFetchRequest *)getFetchRequestBySearchInput:(NSString *)search;
@end
@@ -1,87 +0,0 @@
//
// User+Additions.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "CoreDataStore.h"
#import "User+Additions.h"
#define USER_ID @"id"
#define USER_IMAGE_URL @"imageURL"
#define USER_NAME @"name"
@implementation User (Additions)
+ (User *)createOrUpdateWithServiceResult:(NSDictionary *)data inContext:(NSManagedObjectContext *)context;
{
User *user = [User findFirstByAttribute:@"userId" withValue:data[USER_ID] inContext:context];
if (!user)
{
user = [User insert:context];
}
user.userId = data[USER_ID];
user.userImageURL = data[USER_IMAGE_URL] ;
user.userName = data[USER_NAME];
return user;
}
+ (UIImage *)defaultProfileImage
{
return [UIImage imageNamed:@"default-avatar"];
}
+ (NSPredicate *)getPredicateBySearchInput:(NSString *)search {
if (search && ![search isEqualToString:@""]) {
return [NSPredicate predicateWithFormat:@"userName CONTAINS[cd] %@" , search];
}
return nil;
}
+ (NSFetchRequest *)getFetchRequest {
return [User getFetchRequestBySearchInput:nil];
}
+ (NSFetchRequest *)getFetchRequestBySearchInput:(NSString *)search {
NSFetchRequest * fetchRequest = [User fetchRequest];
fetchRequest.predicate = [User getPredicateBySearchInput:search];
fetchRequest.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"userName" ascending:YES selector:@selector(caseInsensitiveCompare:)]];
return fetchRequest;
}
#pragma mark - XLFormOptionObject
-(NSString *)formDisplayText
{
return self.userName;
}
-(id)formValue
{
return self.userId;
}
@end
@@ -1,36 +0,0 @@
//
// User.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface User : NSManagedObject
@property (nonatomic, retain) NSNumber * userId;
@property (nonatomic, retain) NSString * userName;
@property (nonatomic, retain) NSString * userImageURL;
@end
@@ -1,35 +0,0 @@
//
// User.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "User.h"
@implementation User
@dynamic userId;
@dynamic userName;
@dynamic userImageURL;
@end
@@ -1,30 +0,0 @@
//
// UserLocalDataLoader.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLLocalDataLoader.h"
@interface UserLocalDataLoader : XLLocalDataLoader
@end
@@ -1,60 +0,0 @@
//
// UserLocalDataLoader.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UserLocalDataLoader.h"
#import "User+Additions.h"
#import "CoreDataStore.h"
@implementation UserLocalDataLoader
{
NSString *_searchString;
}
- (id)init {
self = [super init];
if (self) {
NSFetchedResultsController * fetchResultController = [[NSFetchedResultsController alloc] initWithFetchRequest:[User getFetchRequest]
managedObjectContext:[CoreDataStore mainQueueContext]
sectionNameKeyPath:nil
cacheName:nil];
[self setFetchedResultsController:fetchResultController];
}
return self;
}
-(void)changeSearchString:(NSString *)searchString
{
_searchString = searchString;
[self refreshPredicate];
}
- (void)refreshPredicate
{
[self setPredicate:[User getPredicateBySearchInput:_searchString]];
}
@end
@@ -1,30 +0,0 @@
//
// UserRemoteDataLoader.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLRemoteDataLoader.h"
@interface UserRemoteDataLoader : XLRemoteDataLoader
@end
@@ -1,107 +0,0 @@
//
// UserRemoteDataLoader.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UserRemoteDataLoader.h"
#import "HTTPSessionManager.h"
#import "CoreDataStore.h"
#import "User+Additions.h"
@implementation UserRemoteDataLoader
-(NSString *)URLString
{
return @"/mobile/users.json";
}
-(NSDictionary *)parameters
{
NSString *filterParam = self.searchString ?: @"";
return @{@"filter" : filterParam,
@"offset" : @(self.offset),
@"limit" : @(self.limit)};
}
-(AFHTTPSessionManager *)sessionManager
{
return [HTTPSessionManager sharedClient];
}
-(void)successulDataLoad {
// change flags
// [self fetchedData] contains the data coming from the server
NSArray * itemsArray = [[self fetchedData] objectForKey:kXLRemoteDataLoaderDefaultKeyForNonDictionaryResponse];
// This flag indicates if there is more data to load
_hasMoreToLoad = !((itemsArray.count == 0) || (itemsArray.count < _limit && itemsArray.count != 0));
[[CoreDataStore privateQueueContext] performBlock:^{
for (NSDictionary *item in itemsArray) {
// Creates or updates the User and the user who created it with the data that came from the server
[User createOrUpdateWithServiceResult:item[@"user"] inContext:[CoreDataStore privateQueueContext]];
}
[self removeOutdatedData:itemsArray inContext:[CoreDataStore privateQueueContext]];
[CoreDataStore savePrivateQueueContext];
}];
[super successulDataLoad];
}
#pragma mark - Auxiliary Functions
- (void)removeOutdatedData:(NSArray *)data inContext:(NSManagedObjectContext *)context
{
// First, remove older data
NSFetchRequest * fetchRequest = [User getFetchRequestBySearchInput:self.searchString];
fetchRequest.fetchLimit = self.limit;
fetchRequest.fetchOffset = self.offset;
NSError *error;
NSArray * oldObjects = [context executeFetchRequest:fetchRequest error:&error];
NSArray * arrayToIterate = [oldObjects copy];
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedFailureReason ?: error.localizedDescription
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil, nil];
[alertView show];
});
return;
}
for (User *user in arrayToIterate)
{
NSArray *filteredArray = [data filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"user.id == %@" argumentArray:@[user.userId]]];
if (filteredArray.count == 0) {
// This User no longer exists
[context deleteObject:user];
}
}
}
@end
@@ -1,32 +0,0 @@
//
// HTTPSessionManager.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFHTTPSessionManager.h"
@interface HTTPSessionManager : AFHTTPSessionManager
+ (HTTPSessionManager *)sharedClient;
@end
@@ -1,45 +0,0 @@
//
// HTTPSessionManager.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "HTTPSessionManager.h"
@implementation HTTPSessionManager
// Server Base URL
static NSString * const APIBaseURLString = @"http://obscure-refuge-3149.herokuapp.com";
+ (instancetype)sharedClient {
static HTTPSessionManager *_sharedClient = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[HTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:APIBaseURLString]];
[_sharedClient.reachabilityManager startMonitoring];
_sharedClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
});
return _sharedClient;
}
@end
@@ -1,415 +0,0 @@
//
// SelectorsFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <MapKit/MapKit.h>
#import "CLLocationValueTrasformer.h"
#import "MapViewController.h"
#import "CustomSelectorsFormViewController.h"
#import "DynamicSelectorsFormViewController.h"
#import "SelectorsFormViewController.h"
NSString *const kSelectorPush = @"selectorPush";
NSString *const kSelectorPopover = @"selectorPopover";
NSString *const kSelectorActionSheet = @"selectorActionSheet";
NSString *const kSelectorAlertView = @"selectorAlertView";
NSString *const kSelectorLeftRight = @"selectorLeftRight";
NSString *const kSelectorPushDisabled = @"selectorPushDisabled";
NSString *const kSelectorActionSheetDisabled = @"selectorActionSheetDisabled";
NSString *const kSelectorLeftRightDisabled = @"selectorLeftRightDisabled";
NSString *const kSelectorPickerView = @"selectorPickerView";
NSString *const kSelectorPickerViewInline = @"selectorPickerViewInline";
NSString *const kMultipleSelector = @"multipleSelector";
NSString *const kMultipleSelectorPopover = @"multipleSelectorPopover";
NSString *const kDynamicSelectors = @"dynamicSelectors";
NSString *const kCustomSelectors = @"customSelectors";
NSString *const kPickerView = @"pickerView";
NSString *const kSelectorWithSegueId = @"selectorWithSegueId";
NSString *const kSelectorWithSegueClass = @"selectorWithSegueClass";
NSString *const kSelectorWithNibName = @"selectorWithNibName";
NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
#pragma mark - NSValueTransformer
@interface NSArrayValueTrasformer : NSValueTransformer
@end
@implementation NSArrayValueTrasformer
+ (Class)transformedValueClass
{
return [NSString class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
if (!value) return nil;
if ([value isKindOfClass:[NSArray class]]){
NSArray * array = (NSArray *)value;
return [NSString stringWithFormat:@"%@ Item%@", @(array.count), array.count > 1 ? @"s" : @""];
}
if ([value isKindOfClass:[NSString class]])
{
return [NSString stringWithFormat:@"%@ - ;) - Transformed", value];
}
return nil;
}
@end
@interface ISOLanguageCodesValueTranformer : NSValueTransformer
@end
@implementation ISOLanguageCodesValueTranformer
+ (Class)transformedValueClass
{
return [NSString class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
if (!value) return nil;
if ([value isKindOfClass:[NSString class]]){
return [[NSLocale currentLocale] displayNameForKey:NSLocaleLanguageCode value:value];
}
return nil;
}
@end
#pragma mark - SelectorsFormViewController
@implementation SelectorsFormViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initializeForm];
}
return self;
}
- (void)initializeForm
{
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Selectors"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Basic Information
section = [XLFormSectionDescriptor formSectionWithTitle:@"Selectors"];
section.footerTitle = @"SelectorsFormViewController.h";
[form addFormSection:section];
// Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPush rowType:XLFormRowDescriptorTypeSelectorPush title:@"Push"];
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"]
];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
[section addFormRow:row];
// Selector Popover
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"PopOver"];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.value = @"Option 2";
[section addFormRow:row];
}
// Selector Action Sheet
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorActionSheet rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Sheet"];
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"]
];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"];
[section addFormRow:row];
// Selector Alert View
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorAlertView rowType:XLFormRowDescriptorTypeSelectorAlertView title:@"Alert View"];
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"]
];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"];
[section addFormRow:row];
// Selector Left Right
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorLeftRight rowType:XLFormRowDescriptorTypeSelectorLeftRight title:@"Left Right"];
row.leftRightSelectorLeftOptionSelected = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
NSArray * rightOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Right Option 1"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Right Option 2"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Right Option 3"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Right Option 4"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Right Option 5"]
];
// create right selectors
NSMutableArray * leftRightSelectorOptions = [[NSMutableArray alloc] init];
NSMutableArray * mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:0];
XLFormLeftRightSelectorOption * leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"] httpParameterKey:@"option_1" rightOptions:mutableRightOptions];
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:1];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"] httpParameterKey:@"option_2" rightOptions:mutableRightOptions];
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:2];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"] httpParameterKey:@"option_3" rightOptions:mutableRightOptions];
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:3];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"] httpParameterKey:@"option_4" rightOptions:mutableRightOptions];
[leftRightSelectorOptions addObject:leftRightSelectorOption];
mutableRightOptions = [rightOptions mutableCopy];
[mutableRightOptions removeObjectAtIndex:4];
leftRightSelectorOption = [XLFormLeftRightSelectorOption formLeftRightSelectorOptionWithLeftValue:[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"] httpParameterKey:@"option_5" rightOptions:mutableRightOptions];
[leftRightSelectorOptions addObject:leftRightSelectorOption];
row.selectorOptions = leftRightSelectorOptions;
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Right Option 4"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPickerView rowType:XLFormRowDescriptorTypeSelectorPickerView title:@"Picker View"];
row.selectorOptions = @[[XLFormOptionsObject formOptionsObjectWithValue:@(0) displayText:@"Option 1"],
[XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"],
[XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"],
[XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"],
[XLFormOptionsObject formOptionsObjectWithValue:@(4) displayText:@"Option 5"]
];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Option 4"];
[section addFormRow:row];
// --------- Fixed Controls
section = [XLFormSectionDescriptor formSectionWithTitle:@"Fixed Controls"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPickerView rowType:XLFormRowDescriptorTypePicker];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.value = @"Option 1";
[section addFormRow:row];
// --------- Inline Selectors
section = [XLFormSectionDescriptor formSectionWithTitle:@"Inline Selectors"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultipleSelector rowType:XLFormRowDescriptorTypeSelectorPickerViewInline title:@"Inline Picker View"];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.value = @"Option 6";
[section addFormRow:row];
// --------- MultipleSelector
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multiple Selectors"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultipleSelector rowType:XLFormRowDescriptorTypeMultipleSelector title:@"Multiple Selector"];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.value = @[@"Option 1", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
[section addFormRow:row];
// Multiple selector with value tranformer
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultipleSelector rowType:XLFormRowDescriptorTypeMultipleSelector title:@"Multiple Selector"];
row.selectorOptions = @[@"Option 1", @"Option 2", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.value = @[@"Option 1", @"Option 3", @"Option 4", @"Option 5", @"Option 6"];
row.valueTransformer = [NSArrayValueTrasformer class];
[section addFormRow:row];
// Language multiple selector
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultipleSelector rowType:XLFormRowDescriptorTypeMultipleSelector title:@"Multiple Selector"];
row.selectorOptions = [NSLocale ISOLanguageCodes];
row.selectorTitle = @"Languages";
row.valueTransformer = [ISOLanguageCodesValueTranformer class];
row.value = [NSLocale preferredLanguages];
[section addFormRow:row];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
// Language multiple selector popover
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMultipleSelectorPopover rowType:XLFormRowDescriptorTypeMultipleSelectorPopover title:@"Multiple Selector PopOver"];
row.selectorOptions = [NSLocale ISOLanguageCodes];
row.valueTransformer = [ISOLanguageCodesValueTranformer class];
row.value = [NSLocale preferredLanguages];
[section addFormRow:row];
}
// --------- Dynamic Selectors
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dynamic Selectors"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kDynamicSelectors rowType:XLFormRowDescriptorTypeButton title:@"Dynamic Selectors"];
row.action.viewControllerClass = [DynamicSelectorsFormViewController class];
[section addFormRow:row];
// --------- Custom Selectors
section = [XLFormSectionDescriptor formSectionWithTitle:@"Custom Selectors"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomSelectors rowType:XLFormRowDescriptorTypeButton title:@"Custom Selectors"];
row.action.viewControllerClass = [CustomSelectorsFormViewController class];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Disabled & Required Selectors"];
[form addFormSection:section];
// Disabled Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorPushDisabled rowType:XLFormRowDescriptorTypeSelectorPush title:@"Push"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
row.disabled = @YES;
[section addFormRow:row];
// --------- Disabled Selector Action Sheet
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorActionSheetDisabled rowType:XLFormRowDescriptorTypeSelectorActionSheet title:@"Sheet"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(2) displayText:@"Option 3"];
row.disabled = @YES;
[section addFormRow:row];
// --------- Disabled Selector Left Right
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorLeftRightDisabled rowType:XLFormRowDescriptorTypeSelectorLeftRight title:@"Left Right"];
row.leftRightSelectorLeftOptionSelected = [XLFormOptionsObject formOptionsObjectWithValue:@(1) displayText:@"Option 2"];
row.value = [XLFormOptionsObject formOptionsObjectWithValue:@(3) displayText:@"Right Option 4"];
row.disabled = @YES;
[section addFormRow:row];
// --------- Selector definition types
section = [XLFormSectionDescriptor formSectionWithTitle:@"Selectors"];
[form addFormSection:section];
// selector with segue class
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueClass rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Class"];
row.action.formSegueClass = NSClassFromString(@"UIStoryboardPushSegue");
row.action.viewControllerClass = [MapViewController class];
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
// selector with SegueId
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueClass rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Idenfifier"];
row.action.formSegueIdenfifier = @"MapViewControllerSegue";
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
// selector using StoryboardId
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithStoryboardId rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with StoryboardId"];
row.action.viewControllerStoryboardId = @"MapViewController";
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
// selector with NibName
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithNibName rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with NibName"];
row.action.viewControllerNibName = @"MapViewController";
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
self.form = form;
}
-(UIStoryboard *)storyboardForRow:(XLFormRowDescriptor *)formRow
{
return [UIStoryboard storyboardWithName:@"iPhoneStoryboard" bundle:nil];
}
-(void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithTitle:@"Disable" style:UIBarButtonItemStylePlain
target:self
action:@selector(disableEnable:)];
barButton.possibleTitles = [NSSet setWithObjects:@"Disable", @"Enable", nil];
self.navigationItem.rightBarButtonItem = barButton;
}
-(void)disableEnable:(UIBarButtonItem *)button
{
self.form.disabled = !self.form.disabled;
[button setTitle:(self.form.disabled ? @"Enable" : @"Disable")];
[self.tableView endEditing:YES];
[self.tableView reloadData];
}
@end
@@ -1,284 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7531" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="hSO-iI-kK3">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="p4n-1v-pzo" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="SNt-hk-N3V">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="cUg-F9-RF7" kind="relationship" relationship="rootViewController" id="Dli-gX-3ei"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jqF-cF-u4f" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="117" y="56"/>
</scene>
<!--Others Form View Controller-->
<scene sceneID="dyJ-7m-RaD">
<objects>
<viewController storyboardIdentifier="OthersFormViewController" id="oQO-1z-ESS" customClass="OthersFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="oOp-1u-3hE"/>
<viewControllerLayoutGuide type="bottom" id="HPb-Nx-E1G"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="wpr-wE-9nj">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="Hf0-cB-ORN"/>
<connections>
<segue destination="WMh-VN-FWi" kind="push" identifier="MapViewControllerSegue" id="wAD-tS-AFZ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7YZ-ZR-X81" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1533" y="-233"/>
</scene>
<!--Native Event Form View Controller-->
<scene sceneID="EjT-rm-U3h">
<objects>
<viewController id="vx5-lN-WwK" customClass="NativeEventFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Fbw-im-bwR"/>
<viewControllerLayoutGuide type="bottom" id="QuR-kY-o5R"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="tun-QW-CGC">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="JY7-WL-SnH">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="JY7-WL-SnH" firstAttribute="leading" secondItem="tun-QW-CGC" secondAttribute="leading" id="bSe-SV-rx6"/>
<constraint firstAttribute="trailing" secondItem="JY7-WL-SnH" secondAttribute="trailing" id="jLI-68-pSq"/>
<constraint firstItem="QuR-kY-o5R" firstAttribute="top" secondItem="JY7-WL-SnH" secondAttribute="bottom" id="lUW-qG-LqV"/>
<constraint firstItem="JY7-WL-SnH" firstAttribute="top" secondItem="tun-QW-CGC" secondAttribute="top" id="tu2-ah-L2P"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="Xti-ay-J1u"/>
<connections>
<outlet property="tableView" destination="JY7-WL-SnH" id="kPy-NX-IyW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zV0-mq-irv" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1120" y="-635"/>
</scene>
<!--Examples-->
<scene sceneID="wf7-ha-lXx">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="cUg-F9-RF7" customClass="ExamplesFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="kOR-67-djF"/>
<viewControllerLayoutGuide type="bottom" id="0bE-2H-tqE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="PO9-pF-A7O">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="Lxj-Sb-kC6">
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Lxj-Sb-kC6" firstAttribute="top" secondItem="kOR-67-djF" secondAttribute="bottom" id="PT1-Xo-3Ql"/>
<constraint firstAttribute="trailing" secondItem="Lxj-Sb-kC6" secondAttribute="trailing" id="brq-yF-WM8"/>
<constraint firstItem="Lxj-Sb-kC6" firstAttribute="leading" secondItem="PO9-pF-A7O" secondAttribute="leading" id="d73-kq-kX4"/>
<constraint firstItem="0bE-2H-tqE" firstAttribute="top" secondItem="Lxj-Sb-kC6" secondAttribute="bottom" id="ltM-g9-Dgm"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Examples" id="sEr-D1-cU5"/>
<connections>
<outlet property="tableView" destination="Lxj-Sb-kC6" id="IS5-OZ-KBo"/>
<segue destination="oQO-1z-ESS" kind="push" identifier="OthersFormViewControllerSegue" id="ulP-FP-rk3"/>
<segue destination="G68-Ra-1fb" kind="push" identifier="SelectorsFormViewControllerSegue" id="vhA-cV-A02"/>
<segue destination="K9D-4c-9eZ" kind="modal" identifier="NativeEventNavigationViewControllerSegue" id="Iie-Js-Izx"/>
<segue destination="Kiw-nF-jv7" kind="push" identifier="ValidationExamplesFormViewControllerSegue" id="VKe-Ir-Fiu"/>
<segue destination="OG6-Tc-1SC" kind="push" identifier="PredicateFormViewControllerSegue" id="Wwg-e9-gLq"/>
<segue destination="pO0-sS-Tes" kind="push" identifier="BlogExampleViewSegue" id="a28-Gm-Iku"/>
<segue destination="JL7-uU-kWK" kind="push" identifier="BasicPredicateViewControllerSegue" id="SGg-Ve-bng"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1V5-DZ-WfF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="527" y="56"/>
</scene>
<!--Blog Example View Controller-->
<scene sceneID="Vn0-9y-5bc">
<objects>
<viewController id="pO0-sS-Tes" customClass="BlogExampleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gjZ-Jv-Awa"/>
<viewControllerLayoutGuide type="bottom" id="scM-da-Sg0"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="hrV-fb-58s">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="RJB-cz-SnF"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Fvo-wr-5Ca" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="167" y="1151"/>
</scene>
<!--Validation Examples-->
<scene sceneID="z2I-Nk-y9W">
<objects>
<viewController id="Kiw-nF-jv7" customClass="ValidationExamplesFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="AG9-N9-2qp"/>
<viewControllerLayoutGuide type="bottom" id="xtJ-Wo-mhU"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="1Ol-Ra-Ysg">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="Fty-3j-BeF">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="xtJ-Wo-mhU" firstAttribute="top" secondItem="Fty-3j-BeF" secondAttribute="bottom" id="CbV-4f-RzP"/>
<constraint firstItem="Fty-3j-BeF" firstAttribute="top" secondItem="AG9-N9-2qp" secondAttribute="bottom" constant="-64" id="Pdw-VG-qcc"/>
<constraint firstAttribute="trailing" secondItem="Fty-3j-BeF" secondAttribute="trailing" id="nPd-m1-CWF"/>
<constraint firstItem="Fty-3j-BeF" firstAttribute="leading" secondItem="1Ol-Ra-Ysg" secondAttribute="leading" id="qUB-l2-4IG"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Validation Examples" id="apf-4a-VpV">
<barButtonItem key="rightBarButtonItem" title="Validate" id="Thm-OY-hsk"/>
</navigationItem>
<connections>
<outlet property="tableView" destination="Fty-3j-BeF" id="Rck-sk-OHi"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="VFT-Og-STO" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="566" y="938"/>
</scene>
<!--Predicate Form View Controller-->
<scene sceneID="a9p-C8-g8y">
<objects>
<viewController id="OG6-Tc-1SC" customClass="PredicateFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="2YH-dK-JXQ"/>
<viewControllerLayoutGuide type="bottom" id="Lsg-dH-McH"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="6EZ-O7-FjX">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="Lsd-xH-7IN"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="rZL-10-YZn" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="956" y="924"/>
</scene>
<!--Selectors Form View Controller-->
<scene sceneID="KYK-TX-8rm">
<objects>
<viewController id="G68-Ra-1fb" customClass="SelectorsFormViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Z21-Qr-DQ8"/>
<viewControllerLayoutGuide type="bottom" id="CTu-Y5-7Qw"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="bNj-SD-83w">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="Buo-Af-6Q1"/>
<connections>
<segue destination="WMh-VN-FWi" kind="push" identifier="MapViewControllerSegue" id="Mtw-x2-E0b"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8fu-YK-6qz" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1346" y="533"/>
</scene>
<!--Map View Controller-->
<scene sceneID="tAS-lK-35t">
<objects>
<viewController storyboardIdentifier="MapViewController" id="WMh-VN-FWi" customClass="MapViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="9jO-04-Lp1"/>
<viewControllerLayoutGuide type="bottom" id="cgQ-Vs-ICN"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="JjC-E5-SyY">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="BjG-Bq-0lD"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="LmS-YR-mFY" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1789" y="533"/>
</scene>
<!--Native Event Navigation View Controller-->
<scene sceneID="mNb-be-ApA">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="K9D-4c-9eZ" customClass="NativeEventNavigationViewController" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="fO3-V7-XXu">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="vx5-lN-WwK" kind="relationship" relationship="rootViewController" id="gie-et-cUW"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eqB-vl-BzH" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="588" y="-635"/>
</scene>
<!--Basic Predicate View Controller-->
<scene sceneID="pD4-sm-x3a">
<objects>
<viewController id="JL7-uU-kWK" customClass="BasicPredicateViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="OQP-pW-kNp"/>
<viewControllerLayoutGuide type="bottom" id="2b4-gN-85p"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="NZg-t1-g19">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="1lh-jZ-lIV"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Tlw-q2-pcu" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-159" y="1151"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
<segue reference="wAD-tS-AFZ"/>
</inferredMetricsTieBreakers>
</document>
@@ -1,90 +0,0 @@
//
// UICustomizationFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "UICustomizationFormViewController.h"
@implementation UICustomizationFormViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"UI Customization"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Name
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"Name" rowType:XLFormRowDescriptorTypeText title:@"Name"];
// change the background color
[row.cellConfigAtConfigure setObject:[UIColor greenColor] forKey:@"backgroundColor"];
// font
[row.cellConfig setObject:[UIFont fontWithName:@"Helvetica" size:30] forKey:@"textLabel.font"];
// background color
[row.cellConfig setObject:[UIColor grayColor] forKey:@"textField.backgroundColor"];
// font
[row.cellConfig setObject:[UIFont fontWithName:@"Helvetica" size:25] forKey:@"textField.font"];
// alignment
[row.cellConfig setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
[section addFormRow:row];
// Section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
//Button
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"Button" rowType:XLFormRowDescriptorTypeButton title:@"Button"];
[row.cellConfigAtConfigure setObject:[UIColor purpleColor] forKey:@"backgroundColor"];
[row.cellConfig setObject:[UIColor whiteColor] forKey:@"textLabel.color"];
[row.cellConfig setObject:[UIFont fontWithName:@"Helvetica" size:40] forKey:@"textLabel.font"];
[section addFormRow:row];
self.form = form;
}
return self;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// change cell height of a particular cell
if ([[self.form formRowAtIndex:indexPath].tag isEqualToString:@"Name"]){
return 60.0;
}
else if ([[self.form formRowAtIndex:indexPath].tag isEqualToString:@"Button"]){
return 100.0;
}
return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
@end
@@ -1,164 +0,0 @@
//
// ValidationExamplesFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "ValidationExamplesFormViewController.h"
@interface ValidationExamplesFormViewController ()
@end
@implementation ValidationExamplesFormViewController
NSString * const kValidationName = @"kName";
NSString * const kValidationEmail = @"kEmail";
NSString * const kValidationPassword = @"kPassword";
NSString * const kValidationInteger = @"kInteger";
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
}
return self;
}
-(void)initializeForm
{
XLFormDescriptor * formDescriptor = [XLFormDescriptor formDescriptorWithTitle:@"Text Fields"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Name Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Required"];
[formDescriptor addFormSection:section];
// Name
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidationName rowType:XLFormRowDescriptorTypeText title:@"Name"];
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = YES;
row.value = @"Martin";
[section addFormRow:row];
// Email Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Email"];
[formDescriptor addFormSection:section];
// Email
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidationEmail rowType:XLFormRowDescriptorTypeText title:@"Email"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = NO;
row.value = @"not valid email";
[row addValidator:[XLFormValidator emailValidator]];
[section addFormRow:row];
// password Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Password"];
section.footerTitle = @"between 6 and 32 charachers, 1 alphanumeric and 1 numeric";
[formDescriptor addFormSection:section];
// Password
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidationPassword rowType:XLFormRowDescriptorTypePassword title:@"Password"];
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = YES;
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"At least 6, max 32 characters" regex:@"^(?=.*\\d)(?=.*[A-Za-z]).{6,32}$"]];
[section addFormRow:row];
// number Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Numbers"];
section.footerTitle = @"greater than 50 and less than 100";
[formDescriptor addFormSection:section];
// Integer
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidationInteger rowType:XLFormRowDescriptorTypeInteger title:@"Integer"];
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = YES;
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"greater than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
[section addFormRow:row];
self.form = formDescriptor;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.navigationItem.rightBarButtonItem setTarget:self];
[self.navigationItem.rightBarButtonItem setAction:@selector(validateForm:)];
}
#pragma mark - actions
-(void)validateForm:(UIBarButtonItem *)buttonItem
{
NSArray * array = [self formValidationErrors];
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
XLFormValidationStatus * validationStatus = [[obj userInfo] objectForKey:XLValidationStatusErrorKey];
if ([validationStatus.rowDescriptor.tag isEqualToString:kValidationName]){
UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[self.form indexPathOfFormRow:validationStatus.rowDescriptor]];
cell.backgroundColor = [UIColor orangeColor];
[UIView animateWithDuration:0.3 animations:^{
cell.backgroundColor = [UIColor whiteColor];
}];
}
else if ([validationStatus.rowDescriptor.tag isEqualToString:kValidationEmail]){
UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[self.form indexPathOfFormRow:validationStatus.rowDescriptor]];
[self animateCell:cell];
}
else if ([validationStatus.rowDescriptor.tag isEqualToString:kValidationPassword]){
UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[self.form indexPathOfFormRow:validationStatus.rowDescriptor]];
[self animateCell:cell];
}
else if ([validationStatus.rowDescriptor.tag isEqualToString:kValidationInteger]){
UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[self.form indexPathOfFormRow:validationStatus.rowDescriptor]];
[self animateCell:cell];
}
}];
}
#pragma mark - Helper
-(void)animateCell:(UITableViewCell *)cell
{
CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
animation.keyPath = @"position.x";
animation.values = @[ @0, @20, @-20, @10, @0];
animation.keyTimes = @[@0, @(1 / 6.0), @(3 / 6.0), @(5 / 6.0), @1];
animation.duration = 0.3;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
animation.additive = YES;
[cell.layer addAnimation:animation forKey:@"shake"];
}
@end
@@ -38,6 +38,7 @@
28D8326C1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326B1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift */; };
28D8326F1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326E1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift */; };
28F490221AAFBBC600C8E0CC /* DatesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */; };
BF01E92B1C21FF2800BDE045 /* InlineSegmentedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */; };
DD7B43598E698717584375E9 /* libPods-SwiftExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */; };
/* End PBXBuildFile section */
@@ -55,7 +56,7 @@
2860673D1AEDBD4A002F1E04 /* XLFormWeekDaysCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = XLFormWeekDaysCell.xib; sourceTree = "<group>"; };
286067451AEDC3D7002F1E04 /* XLRatingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XLRatingView.swift; sourceTree = "<group>"; };
286E8B731AE809EF00F2767A /* DynamicSelectorsFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DynamicSelectorsFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
286E8B771AE80C4300F2767A /* UsersTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UsersTableViewController.swift; path = Examples/Selectors/DynamicSelector/UsersTableViewController.swift; sourceTree = SOURCE_ROOT; };
286E8B771AE80C4300F2767A /* UsersTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UsersTableViewController.swift; path = SwiftExample/DynamicSelector/UsersTableViewController.swift; sourceTree = SOURCE_ROOT; };
286E8B7C1AE86C8900F2767A /* XLFormCustomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XLFormCustomCell.swift; sourceTree = "<group>"; };
286E8B7D1AE86C8900F2767A /* OthersFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = OthersFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
286E8B811AE9286B00F2767A /* CustomSelectorsFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CustomSelectorsFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
@@ -67,18 +68,19 @@
288646171AE5C7EA007A8B9B /* iPhoneStoryboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = iPhoneStoryboard.storyboard; sourceTree = "<group>"; };
2886461A1AE5C958007A8B9B /* NativeEventFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = NativeEventFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
2886461E1AE5FEB5007A8B9B /* DateAndTimeValueTrasformer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAndTimeValueTrasformer.swift; sourceTree = "<group>"; };
28B920741AE6F02F00BD6382 /* InputsFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = InputsFormViewController.swift; path = Examples/Inputs/InputsFormViewController.swift; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
28B920741AE6F02F00BD6382 /* InputsFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; name = InputsFormViewController.swift; path = SwiftExample/Inputs/InputsFormViewController.swift; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
28B920771AE73AA600BD6382 /* SelectorsFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectorsFormViewController.swift; sourceTree = "<group>"; };
28D832561AEBC4A7009E3B3F /* AccessoryViewFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AccessoryViewFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
28D832601AEBE4E4009E3B3F /* BasicPredicateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicPredicateViewController.swift; sourceTree = "<group>"; };
28D832661AEBEAA0009E3B3F /* BlogExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BlogExampleViewController.swift; path = Examples/PredicateExamples/BlogExampleViewController.swift; sourceTree = SOURCE_ROOT; };
28D832681AEBFE9F009E3B3F /* PredicateFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PredicateFormViewController.swift; path = Examples/PredicateExamples/PredicateFormViewController.swift; sourceTree = SOURCE_ROOT; };
28D832661AEBEAA0009E3B3F /* BlogExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BlogExampleViewController.swift; path = SwiftExample/PredicateExamples/BlogExampleViewController.swift; sourceTree = SOURCE_ROOT; };
28D832681AEBFE9F009E3B3F /* PredicateFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PredicateFormViewController.swift; path = SwiftExample/PredicateExamples/PredicateFormViewController.swift; sourceTree = SOURCE_ROOT; };
28D8326B1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidationExamplesFormViewController.swift; sourceTree = "<group>"; };
28D8326E1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICustomizationFormViewController.swift; sourceTree = "<group>"; };
28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DatesFormViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = "<group>"; };
420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = "<group>"; };
9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwiftExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InlineSegmentedCell.swift; path = InlineSegmentedCell/InlineSegmentedCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -114,19 +116,19 @@
2847A6A01AAF2679000A2ABE /* SwiftExample */ = {
isa = PBXGroup;
children = (
286067311AEDBD4A002F1E04 /* CustomRows */,
28D8326D1AEC2D1B009E3B3F /* UICustomization */,
28D8326A1AEC177E009E3B3F /* Validations */,
28D8325F1AEBE4E4009E3B3F /* PredicateExamples */,
28D832551AEBC4A7009E3B3F /* AccessoryViews */,
286067311AEDBD4A002F1E04 /* CustomRows */,
28F490201AAFBBC600C8E0CC /* Dates */,
28B920711AE6EB6100BD6382 /* Inputs */,
286E8B8A1AE9993F00F2767A /* MultiValuedSections */,
286E8B7A1AE86C8900F2767A /* Others */,
28B920761AE7378400BD6382 /* Selectors */,
28B920711AE6EB6100BD6382 /* Inputs */,
28D8325F1AEBE4E4009E3B3F /* PredicateExamples */,
288646191AE5C958007A8B9B /* RealExamples */,
28B920761AE7378400BD6382 /* Selectors */,
288646161AE5C7EA007A8B9B /* StoryboardExample */,
28D8326D1AEC2D1B009E3B3F /* UICustomization */,
28D8326A1AEC177E009E3B3F /* Validations */,
288646141AE59474007A8B9B /* ExamplesFormViewController.swift */,
28F490201AAFBBC600C8E0CC /* Dates */,
2847A6A31AAF2679000A2ABE /* AppDelegate.swift */,
2847A6A11AAF2679000A2ABE /* Supporting Files */,
);
@@ -146,13 +148,14 @@
286067311AEDBD4A002F1E04 /* CustomRows */ = {
isa = PBXGroup;
children = (
BF01E9291C21FEF700BDE045 /* Inline Segmented */,
286067321AEDBD4A002F1E04 /* CustomRowsViewController.swift */,
286067331AEDBD4A002F1E04 /* FloatLabeledTextField */,
286067351AEDBD4A002F1E04 /* Rating */,
2860673B1AEDBD4A002F1E04 /* Weekdays */,
);
name = CustomRows;
path = Examples/CustomRows;
path = SwiftExample/CustomRows;
sourceTree = SOURCE_ROOT;
};
286067331AEDBD4A002F1E04 /* FloatLabeledTextField */ = {
@@ -318,7 +321,7 @@
28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */,
);
name = Dates;
path = Examples/Dates;
path = SwiftExample/Dates;
sourceTree = SOURCE_ROOT;
};
402AE3EC1FACD058DCF0A2D3 /* Frameworks */ = {
@@ -338,6 +341,14 @@
name = Pods;
sourceTree = "<group>";
};
BF01E9291C21FEF700BDE045 /* Inline Segmented */ = {
isa = PBXGroup;
children = (
BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */,
);
name = "Inline Segmented";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -345,11 +356,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 2847A6BD1AAF2679000A2ABE /* Build configuration list for PBXNativeTarget "SwiftExample" */;
buildPhases = (
21FCE00817B1AE1029F382A4 /* Check Pods Manifest.lock */,
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */,
2847A69A1AAF2679000A2ABE /* Sources */,
2847A69B1AAF2679000A2ABE /* Frameworks */,
2847A69C1AAF2679000A2ABE /* Resources */,
A0F2DA95250A4C3E69515D96 /* Copy Pods Resources */,
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */,
DCA1F7B1D7E04613B3E151C1 /* 📦 Embed Pods Frameworks */,
);
buildRules = (
);
@@ -368,11 +380,12 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Xmartlabs;
TargetAttributes = {
2847A69D1AAF2679000A2ABE = {
CreatedOnToolsVersion = 6.2;
LastSwiftMigration = 0800;
};
};
};
@@ -410,14 +423,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
21FCE00817B1AE1029F382A4 /* Check Pods Manifest.lock */ = {
21FCE00817B1AE1029F382A4 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -425,14 +438,14 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
A0F2DA95250A4C3E69515D96 /* Copy Pods Resources */ = {
A0F2DA95250A4C3E69515D96 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@@ -440,6 +453,21 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
DCA1F7B1D7E04613B3E151C1 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -449,6 +477,7 @@
files = (
28B920781AE73AA600BD6382 /* SelectorsFormViewController.swift in Sources */,
28D832671AEBEAA0009E3B3F /* BlogExampleViewController.swift in Sources */,
BF01E92B1C21FF2800BDE045 /* InlineSegmentedCell.swift in Sources */,
28D8326C1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift in Sources */,
286067411AEDBD4A002F1E04 /* XLFormRatingCell.swift in Sources */,
28F490221AAFBBC600C8E0CC /* DatesFormViewController.swift in Sources */,
@@ -492,8 +521,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -502,6 +533,7 @@
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -536,8 +568,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -545,6 +579,7 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -554,6 +589,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -570,6 +606,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -584,6 +621,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -28,7 +28,7 @@
class AccessoryViewFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let AccessoryViewRowNavigationEnabled = "RowNavigationEnabled"
static let AccessoryViewRowNavigationShowAccessoryView = "RowNavigationShowAccessoryView"
static let AccessoryViewRowNavigationStopDisableRow = "rowNavigationStopDisableRow"
@@ -44,7 +44,7 @@ class AccessoryViewFormViewController : XLFormViewController {
static let AccessoryViewNotes = "notes"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -61,7 +61,7 @@ class AccessoryViewFormViewController : XLFormViewController {
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Accessory View")
form.rowNavigationOptions = .Enabled
form.rowNavigationOptions = .enabled
// Configuration section
section = XLFormSectionDescriptor()
@@ -76,25 +76,25 @@ class AccessoryViewFormViewController : XLFormViewController {
// RowNavigationShowAccessoryView
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationShowAccessoryView, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Show input accessory row?")
row.value = form.rowNavigationOptions.contains(.Enabled)
row.value = form.rowNavigationOptions.contains(.enabled)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationStopDisableRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopDisableRow, rowType: XLFormRowDescriptorTypeBooleanCheck, title:"Stop when reach disabled row?")
row.value = form.rowNavigationOptions.contains(.StopDisableRow)
row.value = form.rowNavigationOptions.contains(.stopDisableRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationStopInlineRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopInlineRow, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "Stop when reach inline row?")
row.value = form.rowNavigationOptions.contains(.StopInlineRow)
row.value = form.rowNavigationOptions.contains(.stopInlineRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationSkipCanNotBecomeFirstResponderRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Skip Can Not Become First Responder Row?")
row.value = form.rowNavigationOptions.contains(XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow)
row.value = form.rowNavigationOptions.contains(XLFormRowNavigationOptions.skipCanNotBecomeFirstResponderRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
@@ -103,18 +103,18 @@ class AccessoryViewFormViewController : XLFormViewController {
// Name
row = XLFormRowDescriptor(tag: Tags.AccessoryViewName, rowType: XLFormRowDescriptorTypeText, title: "Name")
row.required = true
row.isRequired = true
section.addFormRow(row)
// Email
row = XLFormRowDescriptor(tag: Tags.AccessoryViewEmail, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
// validate the email
row.addValidator(XLFormValidator.emailValidator())
row.addValidator(XLFormValidator.email())
section.addFormRow(row)
// Twitter
row = XLFormRowDescriptor(tag: Tags.AccessoryViewTwitter, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
row.disabled = NSNumber(bool: true)
row.disabled = NSNumber(value: true as Bool)
row.value = "@no_editable"
section.addFormRow(row)
@@ -125,7 +125,7 @@ class AccessoryViewFormViewController : XLFormViewController {
// Date
row = XLFormRowDescriptor(tag: Tags.AccessoryViewDate, rowType:XLFormRowDescriptorTypeDateInline, title:"Date Inline")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
@@ -152,43 +152,43 @@ class AccessoryViewFormViewController : XLFormViewController {
}
override func inputAccessoryViewForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> UIView! {
if form.formRowWithTag(Tags.AccessoryViewRowNavigationShowAccessoryView)!.value!.boolValue == false {
override func inputAccessoryView(for rowDescriptor: XLFormRowDescriptor!) -> UIView! {
if (form.formRow(withTag: Tags.AccessoryViewRowNavigationShowAccessoryView)!.value! as AnyObject).boolValue == false {
return nil
}
return super.inputAccessoryViewForRowDescriptor(rowDescriptor)
return super.inputAccessoryView(for: rowDescriptor)
}
//MARK: XLFormDescriptorDelegate
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == Tags.AccessoryViewRowNavigationStopDisableRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.StopDisableRow)
if (formRow.value! as AnyObject).boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.stopDisableRow)
}
else{
form.rowNavigationOptions = form.rowNavigationOptions.subtract(.StopDisableRow)
form.rowNavigationOptions = form.rowNavigationOptions.subtracting(.stopDisableRow)
}
}
else if formRow.tag == Tags.AccessoryViewRowNavigationStopInlineRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.StopInlineRow)
if (formRow.value! as AnyObject).boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.stopInlineRow)
}
else{
var options = form.rowNavigationOptions
options = options.subtract(XLFormRowNavigationOptions.StopInlineRow)
options = options.subtracting(XLFormRowNavigationOptions.stopInlineRow)
form.rowNavigationOptions = options
}
}
else if formRow.tag == Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.SkipCanNotBecomeFirstResponderRow)
if (formRow.value! as AnyObject).boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.skipCanNotBecomeFirstResponderRow)
}
else{
var options = form.rowNavigationOptions
options = options.subtract(.SkipCanNotBecomeFirstResponderRow)
options = options.subtracting(.skipCanNotBecomeFirstResponderRow)
form.rowNavigationOptions = options
}
}
+11 -8
View File
@@ -14,17 +14,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Declare custom rows
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeRate] = "XLFormRatingCell"
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeFloatLabeledTextField] = FloatLabeledTextFieldCell.self
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeWeekDays] = "XLFormWeekDaysCell"
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = InlineSegmentedCell.self
XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedControl] = InlineSegmentedControl.self
XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = XLFormRowDescriptorTypeSegmentedControl
// Override point for customization after application launch.
self.window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
self.window = UIWindow.init(frame: UIScreen.main.bounds)
// Override point for customization after application launch.
self.window!.backgroundColor = .whiteColor()
self.window!.backgroundColor = .white
// load the initial form form Storybiard
let storyboard = UIStoryboard.init(name:"iPhoneStoryboard", bundle:nil)
@@ -33,25 +36,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@@ -1,109 +0,0 @@
// CustomRowsViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "CustomRowsViewController.h"
#import "XLForm.h"
#import "XLFormWeekDaysCell.h"
#import "XLFormRatingCell.h"
#import "FloatLabeledTextFieldCell.h"
#import "XLFormCustomCell.h"
static NSString * const kCustomRowFirstRatingTag = @"CustomRowFirstRatingTag";
static NSString * const kCustomRowSecondRatingTag = @"CustomRowSecondRatingTag";
static NSString * const kCustomRowFloatLabeledTextFieldTag = @"CustomRowFloatLabeledTextFieldTag";
static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays";
static NSString * const kCustomRowText = @"kCustomText";
@implementation CustomRowsViewController
-(id)init
{
self = [super init];
if (self) {
[self initializeForm];
}
return self;
}
-(void)initializeForm
{
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Custom Rows"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Section Ratings
section = [XLFormSectionDescriptor formSectionWithTitle:@"Ratings"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFirstRatingTag rowType:XLFormRowDescriptorTypeRate title:@"First Rating"];
row.value = @(3);
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowSecondRatingTag rowType:XLFormRowDescriptorTypeRate title:@"Second Rating"];
row.value = @(1);
[section addFormRow:row];
// Section Float Labeled Text Field
section = [XLFormSectionDescriptor formSectionWithTitle:@"Float Labeled Text Field"];
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"Title"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"First Name"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowFloatLabeledTextFieldTag rowType:XLFormRowDescriptorTypeFloatLabeledTextField title:@"Last Name"];
[section addFormRow:row];
// Section Weekdays
section = [XLFormSectionDescriptor formSectionWithTitle:@"Weekdays"];
[form addFormSection:section];
// WeekDays
row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowWeekdays rowType:XLFormRowDescriptorTypeWeekDays];
row.value = @{
kSunday: @(NO),
kMonday: @(YES),
kTuesday: @(YES),
kWednesday: @(NO),
kThursday: @(NO),
kFriday: @(NO),
kSaturday: @(NO)
};
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
XLFormRowDescriptor *customRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomRowText rowType:@"XLFormRowDescriptorTypeCustom"];
// Must set custom cell or add custom cell to cellClassesForRowDescriptorTypes dictionary before XLFormViewController loaded
customRowDescriptor.cellClass = [XLFormCustomCell class];
[section addFormRow:customRowDescriptor];
self.form = form;
}
@end
@@ -24,15 +24,16 @@
class CustomRowsViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let CustomRowFirstRatingTag = "CustomRowFirstRatingTag"
static let CustomRowSecondRatingTag = "CustomRowSecondRatingTag"
static let CustomRowFloatLabeledTextFieldTag = "CustomRowFloatLabeledTextFieldTag"
static let CustomRowWeekdays = "CustomRowWeekdays"
static let CustomRowText = "CustomText"
static let CustomRowInline = "CustomRowInline"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
@@ -63,7 +64,7 @@ class CustomRowsViewController : XLFormViewController {
section.addFormRow(row)
// Section Float Labeled Text Field
section = XLFormSectionDescriptor.formSectionWithTitle("Float Labeled Text Field")
section = XLFormSectionDescriptor.formSection(withTitle: "Float Labeled Text Field")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Title")
@@ -76,22 +77,31 @@ class CustomRowsViewController : XLFormViewController {
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Weekdays")
section = XLFormSectionDescriptor.formSection(withTitle: "Weekdays")
form.addFormSection(section)
// WeekDays
row = XLFormRowDescriptor(tag: Tags.CustomRowWeekdays, rowType: XLFormRowDescriptorTypeWeekDays)
row.value = [
XLFormWeekDaysCell.kWeekDay.Sunday.description(): false,
XLFormWeekDaysCell.kWeekDay.Monday.description(): true,
XLFormWeekDaysCell.kWeekDay.Tuesday.description(): true,
XLFormWeekDaysCell.kWeekDay.Wednesday.description(): false,
XLFormWeekDaysCell.kWeekDay.Thursday.description(): false,
XLFormWeekDaysCell.kWeekDay.Friday.description(): false,
XLFormWeekDaysCell.kWeekDay.Saturday.description(): false
XLFormWeekDaysCell.kWeekDay.sunday.description(): false,
XLFormWeekDaysCell.kWeekDay.monday.description(): true,
XLFormWeekDaysCell.kWeekDay.tuesday.description(): true,
XLFormWeekDaysCell.kWeekDay.wednesday.description(): false,
XLFormWeekDaysCell.kWeekDay.thursday.description(): false,
XLFormWeekDaysCell.kWeekDay.friday.description(): false,
XLFormWeekDaysCell.kWeekDay.saturday.description(): false
]
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection(withTitle: "Custom inline row")
form.addFormSection(section)
// Inline
row = XLFormRowDescriptor(tag: Tags.CustomRowInline, rowType: XLFormRowDescriptorTypeSegmentedInline)
row.title = "You support..."
row.selectorOptions = ["Uruguay", "Brazil", "Argentina", "Chile"]
row.value = "Uruguay"
section.addFormRow(row)
section = XLFormSectionDescriptor()
form.addFormSection(section)
@@ -1,187 +0,0 @@
// FloatLabeledTextFieldCell.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "FloatLabeledTextFieldCell.h"
#import "UIView+XLFormAdditions.h"
#import "JVFloatLabeledTextField.h"
#import "NSObject+XLFormAdditions.h"
#import <JVFloatLabeledTextField/JVFloatLabeledTextField.h>
NSString * const XLFormRowDescriptorTypeFloatLabeledTextField = @"XLFormRowDescriptorTypeFloatLabeledTextField";
const static CGFloat kHMargin = 15.0f;
const static CGFloat kVMargin = 8.0f;
const static CGFloat kFloatingLabelFontSize = 11.0f;
@interface FloatLabeledTextFieldCell () <UITextFieldDelegate>
@property (nonatomic) JVFloatLabeledTextField * floatLabeledTextField;
@end
@implementation FloatLabeledTextFieldCell
@synthesize floatLabeledTextField =_floatLabeledTextField;
+(void)load
{
[XLFormViewController.cellClassesForRowDescriptorTypes setObject:[FloatLabeledTextFieldCell class] forKey:XLFormRowDescriptorTypeFloatLabeledTextField];
}
-(JVFloatLabeledTextField *)floatLabeledTextField
{
if (_floatLabeledTextField) return _floatLabeledTextField;
_floatLabeledTextField = [JVFloatLabeledTextField autolayoutView];
_floatLabeledTextField.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
_floatLabeledTextField.floatingLabel.font = [UIFont boldSystemFontOfSize:kFloatingLabelFontSize];
_floatLabeledTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
return _floatLabeledTextField;
}
#pragma mark - XLFormDescriptorCell
-(void)configure
{
[super configure];
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
[self.contentView addSubview:self.floatLabeledTextField];
[self.floatLabeledTextField setDelegate:self];
[self.contentView addConstraints:[self layoutConstraints]];
}
-(void)update
{
[super update];
self.floatLabeledTextField.attributedPlaceholder =
[[NSAttributedString alloc] initWithString:self.rowDescriptor.title
attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]}];
self.floatLabeledTextField.text = self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText;
[self.floatLabeledTextField setEnabled:!self.rowDescriptor.isDisabled];
self.floatLabeledTextField.floatingLabelTextColor = [UIColor lightGrayColor];
[self.floatLabeledTextField setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
}
-(BOOL)formDescriptorCellCanBecomeFirstResponder
{
return !self.rowDescriptor.isDisabled;
}
-(BOOL)formDescriptorCellBecomeFirstResponder
{
return [self.floatLabeledTextField becomeFirstResponder];
}
#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldClear:(UITextField *)textField
{
return [self.formViewController textFieldShouldClear:textField];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
return [self.formViewController textFieldShouldReturn:textField];
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
return [self.formViewController textFieldShouldBeginEditing:textField];
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
return [self.formViewController textFieldShouldEndEditing:textField];
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
return [self.formViewController textField:textField shouldChangeCharactersInRange:range replacementString:string];
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self.formViewController textFieldDidBeginEditing:textField];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
[self textFieldDidChange:textField];
[self.formViewController textFieldDidEndEditing:textField];
}
-(void)setReturnKeyType:(UIReturnKeyType)returnKeyType
{
self.floatLabeledTextField.returnKeyType = returnKeyType;
}
-(UIReturnKeyType)returnKeyType
{
return self.floatLabeledTextField.returnKeyType;
}
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor {
return 55;
}
-(NSArray *)layoutConstraints
{
NSMutableArray * result = [[NSMutableArray alloc] init];
NSDictionary * views = @{@"floatLabeledTextField": self.floatLabeledTextField};
NSDictionary *metrics = @{@"hMargin":@(kHMargin),
@"vMargin":@(kVMargin)};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|"
options:0
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(vMargin)-[floatLabeledTextField]-(vMargin)-|"
options:0
metrics:metrics
views:views]];
return result;
}
#pragma mark - Helpers
- (void)textFieldDidChange:(UITextField *)textField
{
if (self.floatLabeledTextField == textField) {
if ([self.floatLabeledTextField.text length] > 0) {
self.rowDescriptor.value = self.floatLabeledTextField.text;
} else {
self.rowDescriptor.value = nil;
}
}
}
@end
@@ -35,9 +35,9 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
lazy var floatLabeledTextField: JVFloatLabeledTextField = {
let result = JVFloatLabeledTextField(frame: CGRect.zero)
result.translatesAutoresizingMaskIntoConstraints = false
result.font = UIFont.systemFontOfSize(kFontSize)
result.floatingLabel.font = .boldSystemFontOfSize(kFontSize)
result.clearButtonMode = .WhileEditing
result.font = UIFont.systemFont(ofSize: kFontSize)
result.floatingLabel.font = .boldSystemFont(ofSize: kFontSize)
result.clearButtonMode = .whileEditing
return result
}()
@@ -45,7 +45,7 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
override func configure() {
super.configure()
selectionStyle = .None
selectionStyle = .none
contentView.addSubview(self.floatLabeledTextField)
floatLabeledTextField.delegate = self
contentView.addConstraints(layoutConstraints())
@@ -54,15 +54,15 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
override func update() {
super.update()
if let rowDescriptor = rowDescriptor {
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSForegroundColorAttributeName: UIColor.lightGrayColor()])
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSForegroundColorAttributeName: UIColor.lightGray])
if let value = rowDescriptor.value {
floatLabeledTextField.text = value.displayText()
floatLabeledTextField.text = (value as AnyObject).displayText()
}
else {
floatLabeledTextField.text = rowDescriptor.noValueDisplayText
}
floatLabeledTextField.enabled = !rowDescriptor.isDisabled()
floatLabeledTextField.floatingLabelTextColor = .lightGrayColor()
floatLabeledTextField.isEnabled = !rowDescriptor.isDisabled()
floatLabeledTextField.floatingLabelTextColor = .lightGray
floatLabeledTextField.alpha = rowDescriptor.isDisabled() ? 0.6 : 1.0
}
}
@@ -76,7 +76,7 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
return self.floatLabeledTextField.becomeFirstResponder()
}
override static func formDescriptorCellHeightForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
override static func formDescriptorCellHeight(for rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
return 55.0
}
@@ -86,12 +86,12 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
func layoutConstraints() -> [NSLayoutConstraint]{
let views = ["floatLabeledTextField" : floatLabeledTextField]
let metrics = ["hMargin": 15.0, "vMargin": 8.0]
var result = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|", options:.AlignAllCenterY, metrics:metrics, views:views)
result += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(vMargin)-[floatLabeledTextField]-(vMargin)-|", options:.AlignAllCenterX, metrics:metrics, views:views)
var result = NSLayoutConstraint.constraints(withVisualFormat: "H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|", options:.alignAllCenterY, metrics:metrics, views:views)
result += NSLayoutConstraint.constraints(withVisualFormat: "V:|-(vMargin)-[floatLabeledTextField]-(vMargin)-|", options:.alignAllCenterX, metrics:metrics, views:views)
return result
}
func textFieldDidChange(textField : UITextField) {
func textFieldDidChange(_ textField : UITextField) {
if floatLabeledTextField == textField {
if let rowDescriptor = rowDescriptor, let text = self.floatLabeledTextField.text {
if text.isEmpty == false {
@@ -105,34 +105,34 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
//Mark: UITextFieldDelegate
func textFieldShouldClear(textField: UITextField) -> Bool {
func textFieldShouldClear(_ textField: UITextField) -> Bool {
return self.formViewController().textFieldShouldClear(textField)
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
return self.formViewController().textFieldShouldReturn(textField)
}
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
return self.formViewController().textFieldShouldBeginEditing(textField)
}
func textFieldShouldEndEditing(textField: UITextField) -> Bool {
func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
return self.formViewController().textFieldShouldEndEditing(textField)
}
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
return self.formViewController().textField(textField, shouldChangeCharactersInRange: range, replacementString: string)
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
return self.formViewController().textField(textField, shouldChangeCharactersIn: range, replacementString: string)
}
func textFieldDidBeginEditing(textField: UITextField) {
func textFieldDidBeginEditing(_ textField: UITextField) {
self.formViewController().textFieldDidBeginEditing(textField)
}
func textFieldDidEndEditing(textField: UITextField) {
func textFieldDidEndEditing(_ textField: UITextField) {
self.textFieldDidChange(textField)
self.formViewController().textFieldDidEndEditing(textField)
}
@@ -0,0 +1,144 @@
//
// InlineSegmentedCell.swift
// SwiftExample
//
// Created by mathias Claassen on 16/12/15.
// Copyright © 2015 Xmartlabs. All rights reserved.
//
import Foundation
let XLFormRowDescriptorTypeSegmentedInline = "XLFormRowDescriptorTypeSegmentedInline"
let XLFormRowDescriptorTypeSegmentedControl = "XLFormRowDescriptorTypeSegmentedControl"
class InlineSegmentedCell : XLFormBaseCell {
override var canBecomeFirstResponder : Bool {
return true
}
override func becomeFirstResponder() -> Bool {
if isFirstResponder {
return super.becomeFirstResponder()
}
let result = super.becomeFirstResponder()
if result {
let inlineRowDescriptor : XLFormRowDescriptor = XLFormRowDescriptor(tag: nil, rowType: XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes()![rowDescriptor!.rowType] as! String)
let cell = inlineRowDescriptor.cell(forForm: formViewController())
let inlineCell = cell as? XLFormInlineRowDescriptorCell
inlineCell?.inlineRowDescriptor = rowDescriptor
rowDescriptor?.sectionDescriptor.addFormRow(inlineRowDescriptor, afterRow: rowDescriptor!)
formViewController().ensureRowIsVisible(inlineRowDescriptor)
}
return result
}
override func resignFirstResponder() -> Bool {
if !isFirstResponder {
return super.resignFirstResponder()
}
let selectedRowPath : IndexPath = formViewController().form.indexPath(ofFormRow: rowDescriptor!)!
let nextRowPath = IndexPath(row: (selectedRowPath as NSIndexPath).row + 1, section: (selectedRowPath as NSIndexPath).section)
let nextFormRow = formViewController().form.formRow(atIndex: nextRowPath)
let section : XLFormSectionDescriptor = formViewController().form.formSection(at: UInt((nextRowPath as NSIndexPath).section))!
let result = super.resignFirstResponder()
if result {
section.removeFormRow(nextFormRow!)
}
return result
}
//Mark: - XLFormDescriptorCell
override func formDescriptorCellCanBecomeFirstResponder() -> Bool {
return rowDescriptor?.isDisabled() == false
}
override func formDescriptorCellBecomeFirstResponder() -> Bool {
if isFirstResponder {
resignFirstResponder()
return false
}
return becomeFirstResponder()
}
override func update() {
super.update()
accessoryType = .none
editingAccessoryType = .none
selectionStyle = .none
textLabel?.text = rowDescriptor?.title
detailTextLabel?.text = valueDisplayText()
}
override func formDescriptorCellDidSelected(withForm controller: XLFormViewController!) {
controller.tableView.deselectRow(at: controller.form.indexPath(ofFormRow: rowDescriptor!)!, animated: true)
}
func valueDisplayText() -> String? {
if let value = rowDescriptor?.value {
return (value as AnyObject).displayText()
}
return rowDescriptor?.noValueDisplayText
}
}
class InlineSegmentedControl : XLFormBaseCell, XLFormInlineRowDescriptorCell {
var inlineRowDescriptor : XLFormRowDescriptor?
lazy var segmentedControl : UISegmentedControl = {
return UISegmentedControl.autolayoutView() as! UISegmentedControl
}()
override func configure() {
super.configure()
selectionStyle = .none
contentView.addSubview(segmentedControl)
contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-[segmentedControl]-|", options: .alignAllCenterY, metrics: nil, views: ["segmentedControl": segmentedControl]))
segmentedControl.addTarget(self, action: #selector(InlineSegmentedControl.valueChanged), for: .valueChanged)
}
override func update() {
super.update()
updateSegmentedControl()
segmentedControl.selectedSegmentIndex = selectedIndex()
segmentedControl.isEnabled = rowDescriptor?.isDisabled() == false
}
//MARK: Actions
func valueChanged() {
inlineRowDescriptor!.value = inlineRowDescriptor!.selectorOptions![segmentedControl.selectedSegmentIndex]
formViewController().updateFormRow(inlineRowDescriptor)
}
//MARK: Helpers
func getItems() -> NSMutableArray {
let result = NSMutableArray()
for option in inlineRowDescriptor!.selectorOptions! {
result.add((option as AnyObject).displayText())
}
return result
}
func updateSegmentedControl() {
segmentedControl.removeAllSegments()
getItems().enumerateObjects({ [weak self] (object, index, stop) in
self?.segmentedControl.insertSegment(withTitle: (object as AnyObject).displayText(), at: index, animated: false)
})
}
func selectedIndex() -> Int {
let formRow = inlineRowDescriptor ?? rowDescriptor
if let value = formRow?.value as? NSObject {
for option in (formRow?.selectorOptions)! {
if ((option as! NSObject).valueData() as AnyObject) === (value.valueData() as AnyObject) {
return formRow?.selectorOptions?.index(where: { ($0 as! NSObject) == (option as! NSObject) } ) ?? -1
}
}
}
return -1
}
}
@@ -1,29 +0,0 @@
// XLRatingView.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <AXRatingView/AXRatingView.h>
@interface XLRatingView : AXRatingView
@end
@@ -1,69 +0,0 @@
// XLRatingView.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLRatingView.h"
@implementation XLRatingView
- (instancetype)init
{
self = [super init];
if (self) {
[self customize];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self customize];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
[self customize];
}
return self;
}
- (void)customize
{
UIColor * grayColor = [UIColor colorWithRed:(205/255.0) green:(201/255.0) blue:(201/255.0) alpha:1];
self.baseColor = grayColor;
UIColor * goldColor = [UIColor colorWithRed:(255/255.0) green:(215/255.0) blue:0 alpha:1];
self.highlightColor = goldColor;
self.markFont = [UIFont systemFontOfSize:23.0f];
self.translatesAutoresizingMaskIntoConstraints = NO;
self.stepInterval = 1.0f;
}
@end
@@ -39,7 +39,7 @@ class XLRatingView : AXRatingView {
func customize() {
baseColor = UIColor(red: (205/255.0), green: (201/255.0), blue: (201/255.0), alpha: 1)
highlightColor = UIColor(red: (255/255.0), green: (215/255.0), blue: 0, alpha: 1)
markFont = UIFont.systemFontOfSize(23.0)
markFont = UIFont.systemFont(ofSize: 23.0)
stepInterval = 1.0
}
@@ -1,62 +0,0 @@
// XLFormRatingCell.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLFormRatingCell.h"
NSString * const XLFormRowDescriptorTypeRate = @"XLFormRowDescriptorTypeRate";
@implementation XLFormRatingCell
+(void)load
{
[XLFormViewController.cellClassesForRowDescriptorTypes setObject:NSStringFromClass([XLFormRatingCell class]) forKey:XLFormRowDescriptorTypeRate];
}
- (void)configure
{
[super configure];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.ratingView addTarget:self action:@selector(rateChanged:) forControlEvents:UIControlEventValueChanged];
}
- (void)update
{
[super update];
self.ratingView.value = [self.rowDescriptor.value floatValue];
self.rateTitle.text = self.rowDescriptor.title;
[self.ratingView setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.rateTitle setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
}
#pragma mark - Events
-(void)rateChanged:(AXRatingView *)ratingView
{
self.rowDescriptor.value = [NSNumber numberWithFloat:ratingView.value];
}
@end
@@ -34,14 +34,14 @@ class XLFormRatingCell : XLFormBaseCell {
override func configure() {
super.configure()
selectionStyle = .None
ratingView.addTarget(self, action: "rateChanged:", forControlEvents:.ValueChanged)
selectionStyle = .none
ratingView.addTarget(self, action: #selector(XLFormRatingCell.rateChanged(_:)), for:.valueChanged)
}
override func update() {
super.update()
ratingView.value = rowDescriptor!.value!.floatValue
ratingView.value = (rowDescriptor!.value! as AnyObject).floatValue
rateTitle.text = rowDescriptor!.title
ratingView.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
rateTitle.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
@@ -49,7 +49,7 @@ class XLFormRatingCell : XLFormBaseCell {
//MARK: Events
func rateChanged(ratingView : XLRatingView){
func rateChanged(_ ratingView : XLRatingView){
rowDescriptor!.value = ratingView.value
}
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="478" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="OGo-4x-YLf" id="hV6-xt-6pq">
<rect key="frame" x="0.0" y="0.0" width="478" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yhI-dj-sRk" customClass="XLRatingView">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yhI-dj-sRk" customClass="XLRatingView" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="353" y="11" width="115" height="22"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
@@ -28,7 +29,7 @@
<constraint firstAttribute="width" constant="150" id="hNG-F9-1wj"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
@@ -48,8 +49,8 @@
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="rateTitle" destination="Vxp-gw-YTt" id="KRL-Lg-C7F"/>
<outlet property="ratingView" destination="yhI-dj-sRk" id="QBD-SA-AlI"/>
<outlet property="rateTitle" destination="Vxp-gw-YTt" id="0Qh-NC-yq5"/>
<outlet property="ratingView" destination="yhI-dj-sRk" id="BKM-pX-m9F"/>
</connections>
<point key="canvasLocation" x="301" y="260"/>
</tableViewCell>
@@ -1,154 +0,0 @@
// XLFormWeekDaysCell.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLFormWeekDaysCell.h"
NSString * const XLFormRowDescriptorTypeWeekDays = @"XLFormRowDescriptorTypeWeekDays";
NSString *const kSunday= @"sunday";
NSString *const kMonday = @"monday";
NSString *const kTuesday = @"tuesday";
NSString *const kWednesday = @"wednesday";
NSString *const kThursday = @"thursday";
NSString *const kFriday = @"friday";
NSString *const kSaturday = @"saturday";
@interface XLFormWeekDaysCell()
@property (weak, nonatomic) IBOutlet UIButton *sundayButton;
@property (weak, nonatomic) IBOutlet UIButton *mondayButton;
@property (weak, nonatomic) IBOutlet UIButton *tuesdayButton;
@property (weak, nonatomic) IBOutlet UIButton *wednesdayButton;
@property (weak, nonatomic) IBOutlet UIButton *thursdayButton;
@property (weak, nonatomic) IBOutlet UIButton *fridayButton;
@property (weak, nonatomic) IBOutlet UIButton *saturdayButton;
@end
@implementation XLFormWeekDaysCell
+(void)load
{
[XLFormViewController.cellClassesForRowDescriptorTypes setObject:NSStringFromClass([XLFormWeekDaysCell class]) forKey:XLFormRowDescriptorTypeWeekDays];
}
#pragma mark - XLFormDescriptorCell
- (void)configure
{
[super configure];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self configureButtons];
}
-(void)update
{
[super update];
[self updateButtons];
}
#pragma mark - Action
- (IBAction)dayTapped:(id)sender {
[self dayTapped:sender day:[self getDayFormButton:sender]];
}
#pragma mark - Helpers
-(void)configureButtons
{
for (UIView *subview in self.contentView.subviews)
{
if ([subview isKindOfClass:[UIButton class]])
{
UIButton * button = (UIButton *)subview;
[button setImage:[UIImage imageNamed:@"uncheckedDay"] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"checkedDay"] forState:UIControlStateSelected];
button.adjustsImageWhenHighlighted = NO;
[self imageTopTitleBottom:button];
}
}
}
-(void)updateButtons
{
NSDictionary * value = self.rowDescriptor.value;
self.sundayButton.selected = [[value objectForKey:kSunday] boolValue];
self.mondayButton.selected = [[value objectForKey:kMonday] boolValue];
self.tuesdayButton.selected = [[value objectForKey:kTuesday] boolValue];
self.wednesdayButton.selected = [[value objectForKey:kWednesday] boolValue];
self.thursdayButton.selected = [[value objectForKey:kThursday] boolValue];
self.fridayButton.selected = [[value objectForKey:kFriday] boolValue];
self.saturdayButton.selected = [[value objectForKey:kSaturday] boolValue];
[self.sundayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.mondayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.tuesdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.wednesdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.thursdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.fridayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
[self.saturdayButton setAlpha:((self.rowDescriptor.isDisabled) ? .6 : 1)];
}
-(NSString *)getDayFormButton:(id)sender
{
if (sender == self.sundayButton) return kSunday;
if (sender == self.mondayButton) return kMonday;
if (sender == self.tuesdayButton) return kTuesday;
if (sender == self.wednesdayButton) return kWednesday;
if (sender == self.thursdayButton) return kThursday;
if (sender == self.fridayButton) return kFriday;
return kSaturday;
}
-(void)dayTapped:(UIButton *)button day:(NSString *)day
{
button.selected = !button.selected;
NSMutableDictionary * value = [self.rowDescriptor.value mutableCopy];
[value setObject:@(button.selected) forKey:day];
self.rowDescriptor.value = value;
}
-(void)imageTopTitleBottom:(UIButton *)button
{
// the space between the image and text
CGFloat spacing = 3.0;
// lower the text and push it left so it appears centered
// below the image
CGSize imageSize = button.imageView.image.size;
button.titleEdgeInsets = UIEdgeInsetsMake(0.0, - imageSize.width, - (imageSize.height + spacing), 0.0);
// raise the image and push it right so it appears centered
// above the text
CGSize titleSize = [button.titleLabel.text sizeWithAttributes:@{NSFontAttributeName: button.titleLabel.font}];
button.imageEdgeInsets = UIEdgeInsetsMake(- (titleSize.height + spacing), 0.0, 0.0, - titleSize.width);
}
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
{
return 60;
}
@end
@@ -30,29 +30,29 @@ class XLFormWeekDaysCell : XLFormBaseCell {
enum kWeekDay: Int {
case
Sunday = 1,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
sunday = 1,
monday,
tuesday,
wednesday,
thursday,
friday,
saturday
func description() -> String {
switch self {
case .Sunday:
case .sunday:
return "Sunday"
case .Monday:
case .monday:
return "Monday"
case .Tuesday:
case .tuesday:
return "Tuesday"
case .Wednesday:
case .wednesday:
return "Wednesday"
case .Thursday:
case .thursday:
return "Thursday"
case .Friday:
case .friday:
return "Friday"
case .Saturday:
case .saturday:
return "Saturday"
}
}
@@ -60,13 +60,13 @@ class XLFormWeekDaysCell : XLFormBaseCell {
//Add Custom Functions
//Allows for iteration as needed (for in ...)
static let allValues = [Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday]
static let allValues = [sunday,
monday,
tuesday,
wednesday,
thursday,
friday,
saturday]
}
@IBOutlet weak var sundayButton: UIButton!
@@ -81,7 +81,7 @@ class XLFormWeekDaysCell : XLFormBaseCell {
override func configure() {
super.configure()
selectionStyle = .None
selectionStyle = .none
configureButtons()
}
@@ -91,17 +91,17 @@ class XLFormWeekDaysCell : XLFormBaseCell {
updateButtons()
}
override static func formDescriptorCellHeightForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
override static func formDescriptorCellHeight(for rowDescriptor: XLFormRowDescriptor!) -> CGFloat {
return 60
}
//MARK: - Action
@IBAction func dayTapped(sender: UIButton) {
@IBAction func dayTapped(_ sender: UIButton) {
let day = getDayFormButton(sender)
sender.selected = !sender.selected
sender.isSelected = !sender.isSelected
var newValue = rowDescriptor!.value as! Dictionary<String, Bool>
newValue[day] = sender.selected
newValue[day] = sender.isSelected
rowDescriptor!.value = newValue
}
@@ -110,8 +110,8 @@ class XLFormWeekDaysCell : XLFormBaseCell {
func configureButtons() {
for subview in contentView.subviews {
if let button = subview as? UIButton {
button.setImage(UIImage(named: "uncheckedDay"), forState: .Normal)
button.setImage(UIImage(named: "checkedDay"), forState: .Selected)
button.setImage(UIImage(named: "uncheckedDay"), for: UIControlState())
button.setImage(UIImage(named: "checkedDay"), for: .selected)
button.adjustsImageWhenHighlighted = false
imageTopTitleBottom(button)
}
@@ -122,13 +122,13 @@ class XLFormWeekDaysCell : XLFormBaseCell {
func updateButtons() {
var value = rowDescriptor!.value as! Dictionary<String, Bool>
sundayButton.selected = value[kWeekDay.Sunday.description()]!
mondayButton.selected = value[kWeekDay.Monday.description()]!
tuesdayButton.selected = value[kWeekDay.Tuesday.description()]!
wednesdayButton.selected = value[kWeekDay.Wednesday.description()]!
thursdayButton.selected = value[kWeekDay.Thursday.description()]!
fridayButton.selected = value[kWeekDay.Friday.description()]!
saturdayButton.selected = value[kWeekDay.Saturday.description()]!
sundayButton.isSelected = value[kWeekDay.sunday.description()]!
mondayButton.isSelected = value[kWeekDay.monday.description()]!
tuesdayButton.isSelected = value[kWeekDay.tuesday.description()]!
wednesdayButton.isSelected = value[kWeekDay.wednesday.description()]!
thursdayButton.isSelected = value[kWeekDay.thursday.description()]!
fridayButton.isSelected = value[kWeekDay.friday.description()]!
saturdayButton.isSelected = value[kWeekDay.saturday.description()]!
sundayButton.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
mondayButton.alpha = mondayButton.alpha
@@ -139,7 +139,7 @@ class XLFormWeekDaysCell : XLFormBaseCell {
saturdayButton.alpha = mondayButton.alpha
}
func imageTopTitleBottom(button: UIButton) {
func imageTopTitleBottom(_ button: UIButton) {
// the space between the image and text
let spacing : CGFloat = 3.0
@@ -150,26 +150,26 @@ class XLFormWeekDaysCell : XLFormBaseCell {
// raise the image and push it right so it appears centered
// above the text
let titleSize : CGSize = (button.titleLabel!.text! as NSString).sizeWithAttributes([NSFontAttributeName: button.titleLabel!.font])
let titleSize : CGSize = (button.titleLabel!.text! as NSString).size(attributes: [NSFontAttributeName: button.titleLabel!.font])
button.imageEdgeInsets = UIEdgeInsetsMake(-(titleSize.height + spacing), 0.0, 0.0, -titleSize.width)
}
func getDayFormButton(button: UIButton) -> String {
func getDayFormButton(_ button: UIButton) -> String {
switch button {
case sundayButton:
return kWeekDay.Sunday.description()
return kWeekDay.sunday.description()
case mondayButton:
return kWeekDay.Monday.description()
return kWeekDay.monday.description()
case tuesdayButton:
return kWeekDay.Tuesday.description()
return kWeekDay.tuesday.description()
case wednesdayButton:
return kWeekDay.Wednesday.description()
return kWeekDay.wednesday.description()
case thursdayButton:
return kWeekDay.Thursday.description()
return kWeekDay.thursday.description()
case fridayButton:
return kWeekDay.Friday.description()
return kWeekDay.friday.description()
default:
return kWeekDay.Saturday.description()
return kWeekDay.saturday.description()
}
}
@@ -1,27 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell" customModule="SwiftExample" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="382" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="piA-L5-eiN" id="Yr6-3E-keb">
<rect key="frame" x="0.0" y="0.0" width="382" height="49"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZAg-Me-yKR">
<rect key="frame" x="5" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="selected">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="dayTapped:" destination="piA-L5-eiN" eventType="touchUpInside" id="K4V-Xd-Bak"/>
@@ -38,7 +39,7 @@
<rect key="frame" x="58" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="M">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -56,7 +57,7 @@
<rect key="frame" x="111" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -74,7 +75,7 @@
<rect key="frame" x="164" y="0.0" width="54" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="W">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -92,7 +93,7 @@
<rect key="frame" x="218" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -110,7 +111,7 @@
<rect key="frame" x="271" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="F">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -128,7 +129,7 @@
<rect key="frame" x="324" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
@@ -28,12 +28,12 @@ import MapKit
class CustomSelectorsFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let SelectorMap = "selectorMap"
static let SelectorMapPopover = "selectorMapPopover"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -51,7 +51,7 @@ class CustomSelectorsFormViewController : XLFormViewController {
form = XLFormDescriptor(title: "Custom Selectors")
section = XLFormSectionDescriptor.formSectionWithTitle("TextField Types")
section = XLFormSectionDescriptor.formSection(withTitle: "TextField Types")
section.footerTitle = "CustomSelectorsFormViewController.swift"
form.addFormSection(section)
@@ -62,7 +62,7 @@ class CustomSelectorsFormViewController : XLFormViewController {
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
if UIDevice.current.userInterfaceIdiom == .pad {
// Selector PopOver
row = XLFormRowDescriptor(tag: Tags.SelectorMapPopover, rowType: XLFormRowDescriptorTypeSelectorPopover, title: "Coordinate PopOver")
row.action.viewControllerClass = MapViewController.self
@@ -26,7 +26,7 @@
import MapKit
class CLLocationValueTrasformer : NSValueTransformer {
class CLLocationValueTrasformer : ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSString.self
@@ -37,7 +37,7 @@ class CLLocationValueTrasformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
override func transformedValue(_ value: Any?) -> Any? {
if let valueData = value, let location = valueData as? CLLocation{
return String(format: "%0.4f, %0.4f", location.coordinate.latitude, location.coordinate.longitude)
}
@@ -42,11 +42,11 @@ class MapViewController : UIViewController, XLFormRowDescriptorViewController, M
var rowDescriptor: XLFormRowDescriptor?
lazy var mapView : MKMapView = { [unowned self] in
let mapView = MKMapView(frame: self.view.frame)
mapView.autoresizingMask = [UIViewAutoresizing.FlexibleHeight, UIViewAutoresizing.FlexibleWidth]
mapView.autoresizingMask = [UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleWidth]
return mapView
}()
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
@@ -60,7 +60,7 @@ class MapViewController : UIViewController, XLFormRowDescriptorViewController, M
view.addSubview(mapView)
mapView.delegate = self
if let value = rowDescriptor?.value as? CLLocation {
mapView.setCenterCoordinate(value.coordinate, animated: false)
mapView.setCenter(value.coordinate, animated: false)
title = String(format: "%0.4f, %0.4f", mapView.centerCoordinate.latitude, mapView.centerCoordinate.longitude)
let annotation = MapAnnotation()
annotation.coordinate = value.coordinate
@@ -70,18 +70,18 @@ class MapViewController : UIViewController, XLFormRowDescriptorViewController, M
//MARK - - MKMapViewDelegate
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
pinAnnotationView.pinColor = MKPinAnnotationColor.Red
pinAnnotationView.draggable = true
pinAnnotationView.pinColor = MKPinAnnotationColor.red
pinAnnotationView.isDraggable = true
pinAnnotationView.animatesDrop = true
return pinAnnotationView
}
func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, didChangeDragState newState: MKAnnotationViewDragState, fromOldState oldState: MKAnnotationViewDragState) {
if (newState == .Ending){
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, didChange newState: MKAnnotationViewDragState, fromOldState oldState: MKAnnotationViewDragState) {
if (newState == .ending){
if let rowDescriptor = rowDescriptor, let annotation = view.annotation {
rowDescriptor.value = CLLocation(latitude:annotation.coordinate.latitude, longitude:annotation.coordinate.longitude)
self.title = String(format: "%0.4f, %0.4f", annotation.coordinate.latitude, annotation.coordinate.longitude)
@@ -23,7 +23,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class DateValueTrasformer : NSValueTransformer {
class DateValueTrasformer : ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSString.self
@@ -34,18 +34,18 @@ class DateValueTrasformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
if let date = value as? NSDate {
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = .FullStyle
dateFormatter.timeStyle = .NoStyle
return dateFormatter.stringFromDate(date)
override func transformedValue(_ value: Any?) -> Any? {
if let date = value as? Date {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .full
dateFormatter.timeStyle = .none
return dateFormatter.string(from: date)
}
return nil
}
}
class DateTimeValueTrasformer: NSValueTransformer {
class DateTimeValueTrasformer: ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSString.self
@@ -56,12 +56,12 @@ class DateTimeValueTrasformer: NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
if let date = value as? NSDate {
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .ShortStyle
return dateFormatter.stringFromDate(date)
override func transformedValue(_ value: Any?) -> Any? {
if let date = value as? Date {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .short
return dateFormatter.string(from: date)
}
return nil
}
@@ -26,7 +26,7 @@
class DatesFormViewController: XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let DateInline = "dateInline"
static let TimeInline = "timeInline"
static let DateTimeInline = "dateTimeInline"
@@ -38,7 +38,7 @@ class DatesFormViewController: XLFormViewController {
static let CountDownTimer = "countDownTimer"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -50,15 +50,15 @@ class DatesFormViewController: XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
let barButton = UIBarButtonItem(title: "Disable", style: .plain, target: self, action: #selector(DatesFormViewController.disableEnable(_:)))
barButton.possibleTitles = Set(["Disable", "Enable"])
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem){
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
func disableEnable(_ button : UIBarButtonItem){
form.isDisabled = !form.isDisabled
button.title = form.isDisabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
@@ -70,78 +70,79 @@ class DatesFormViewController: XLFormViewController {
form = XLFormDescriptor(title: "Date & Time")
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Dates")
section = XLFormSectionDescriptor.formSection(withTitle: "Inline Dates")
form.addFormSection(section)
// Date
row = XLFormRowDescriptor(tag: Tags.DateInline, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
row.value = NSDate()
row.value = Date()
row.cellConfigAtConfigure["locale"] = Locale(identifier: "FR_fr")
section.addFormRow(row)
// Time
row = XLFormRowDescriptor(tag: Tags.TimeInline, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
// DateTime
row = XLFormRowDescriptor(tag: Tags.DateTimeInline, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
// CountDownTimer
row = XLFormRowDescriptor(tag: Tags.CountDownTimerInline, rowType:XLFormRowDescriptorTypeCountDownTimerInline, title:"Countdown Timer")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Dates") //
section = XLFormSectionDescriptor.formSection(withTitle: "Dates") //
form.addFormSection(section)
// Date
row = XLFormRowDescriptor(tag: Tags.Date, rowType:XLFormRowDescriptorTypeDate, title:"Date")
row.value = NSDate()
row.cellConfigAtConfigure["minimumDate"] = NSDate()
row.cellConfigAtConfigure["maximumDate"] = NSDate(timeIntervalSinceNow: 60*60*24*3)
row.value = Date()
row.cellConfigAtConfigure["minimumDate"] = Date()
row.cellConfigAtConfigure["maximumDate"] = Date(timeIntervalSinceNow: 60*60*24*3)
section.addFormRow(row)
// Time
row = XLFormRowDescriptor(tag: Tags.Time, rowType: XLFormRowDescriptorTypeTime, title: "Time")
row.cellConfigAtConfigure["minuteInterval"] = 10
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
// DateTime
row = XLFormRowDescriptor(tag: Tags.DateTime, rowType: XLFormRowDescriptorTypeDateTime, title: "Date Time")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
// CountDownTimer
row = XLFormRowDescriptor(tag: Tags.CountDownTimer, rowType: XLFormRowDescriptorTypeCountDownTimer, title: "Countdown Timer")
row.value = NSDate()
row.value = Date()
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Disabled Dates")
section = XLFormSectionDescriptor.formSection(withTitle: "Disabled Dates")
section.footerTitle = "DatesFormViewController.swift"
form.addFormSection(section)
// Date
row = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeDate, title: "Date")
row.disabled = NSNumber(bool: true)
row.required = true
row.value = NSDate()
row.disabled = NSNumber(value: true as Bool)
row.isRequired = true
row.value = Date()
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("DatePicker")
section = XLFormSectionDescriptor.formSection(withTitle: "DatePicker")
form.addFormSection(section)
// DatePicker
row = XLFormRowDescriptor(tag: Tags.DatePicker, rowType:XLFormRowDescriptorTypeDatePicker)
row.cellConfigAtConfigure["datePicker.datePickerMode"] = UIDatePickerMode.Date.rawValue
row.value = NSDate()
row.cellConfigAtConfigure["datePicker.datePickerMode"] = UIDatePickerMode.date.rawValue
row.value = Date()
section.addFormRow(row)
@@ -150,8 +151,7 @@ class DatesFormViewController: XLFormViewController {
// MARK: - XLFormDescriptorDelegate
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == Tags.DatePicker {
let alertView = UIAlertView(title: "DatePicker", message: "Value Has changed!", delegate: self, cancelButtonTitle: "OK")
@@ -1,31 +0,0 @@
//
// DynamicSelectorsFormViewController.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLForm.h"
#import "XLFormViewController.h"
@interface DynamicSelectorsFormViewController : XLFormViewController
@end
@@ -1,66 +0,0 @@
//
// DynamicSelectorsFormViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UsersTableViewController.h"
#import "DynamicSelectorsFormViewController.h"
NSString *const kSelectorUser = @"selectorUser";
NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
@implementation DynamicSelectorsFormViewController
-(id)init
{
self = [super init];
if (self) {
XLFormDescriptor * form = [XLFormDescriptor formDescriptorWithTitle:@"Selectors"];
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
// Basic Information
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dynamic Selectors"];
section.footerTitle = @"DynamicSelectorsFormViewController.h";
[form addFormSection:section];
// Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUser rowType:XLFormRowDescriptorTypeSelectorPush title:@"User"];
row.action.viewControllerClass = [UsersTableViewController class];
[section addFormRow:row];
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad){
// Selector PopOver
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUserPopover rowType:XLFormRowDescriptorTypeSelectorPopover title:@"User Popover"];
row.action.viewControllerClass = [UsersTableViewController class];
[section addFormRow:row];
}
self.form = form;
}
return self;
}
@end
@@ -25,7 +25,7 @@
class DynamicSelectorsFormViewController : XLFormViewController {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -42,7 +42,7 @@ class DynamicSelectorsFormViewController : XLFormViewController {
var row : XLFormRowDescriptor
// Basic Information
section = XLFormSectionDescriptor.formSectionWithTitle("Dynamic Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Dynamic Selectors")
section.footerTitle = "DynamicSelectorsFormViewController.swift"
form.addFormSection(section)
@@ -51,7 +51,7 @@ class DynamicSelectorsFormViewController : XLFormViewController {
row.action.viewControllerClass = UsersTableViewController.self
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
if UIDevice.current.userInterfaceIdiom == .pad {
// Selector PopOver
row = XLFormRowDescriptor(tag: "selectorUserPopover", rowType:XLFormRowDescriptorTypeSelectorPopover, title:"User Popover")
row.action.viewControllerClass = UsersTableViewController.self
@@ -1,31 +0,0 @@
//
// UsersTableViewController.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLFormRowDescriptor.h"
#import "XLTableViewController.h"
@interface UsersTableViewController : XLTableViewController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
@end
@@ -1,245 +0,0 @@
//
// UsersTableViewController.m
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UsersTableViewController.h"
#import "UserLocalDataLoader.h"
#import "UserRemoteDataLoader.h"
#import "User+Additions.h"
// AFNetworking
#import <AFNetworking/UIImageView+AFNetworking.h>
@interface UserCell : UITableViewCell
@property (nonatomic) UIImageView * userImage;
@property (nonatomic) UILabel * userName;
@end
@implementation UserCell
@synthesize userImage = _userImage;
@synthesize userName = _userName;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
[self.contentView addSubview:self.userImage];
[self.contentView addSubview:self.userName];
[self.contentView addConstraints:[self layoutConstraints]];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark - Views
-(UIImageView *)userImage
{
if (_userImage) return _userImage;
_userImage = [UIImageView new];
[_userImage setTranslatesAutoresizingMaskIntoConstraints:NO];
_userImage.layer.masksToBounds = YES;
_userImage.layer.cornerRadius = 10.0f;
return _userImage;
}
-(UILabel *)userName
{
if (_userName) return _userName;
_userName = [UILabel new];
[_userName setTranslatesAutoresizingMaskIntoConstraints:NO];
_userName.font = [UIFont fontWithName:@"HelveticaNeue" size:15.f];
return _userName;
}
#pragma mark - Layout Constraints
-(NSArray *)layoutConstraints{
NSMutableArray * result = [NSMutableArray array];
NSDictionary * views = @{ @"image": self.userImage,
@"name": self.userName};
NSDictionary *metrics = @{@"imgSize":@50.0,
@"margin" :@12.0};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
options:NSLayoutFormatAlignAllTop
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[image(imgSize)]"
options:0
metrics:metrics
views:views]];
return result;
}
@end
@interface UsersTableViewController ()
@end
@implementation UsersTableViewController
@synthesize rowDescriptor = _rowDescriptor;
@synthesize popoverController = __popoverController;
static NSString *const kCellIdentifier = @"CellIdentifier";
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self initialize];
}
return self;
}
-(void)initialize
{
// Enable the pagination
self.loadingPagingEnabled = YES;
// Support Search Controller
self.supportSearchController = YES;
[self setLocalDataLoader:[[UserLocalDataLoader alloc] init]];
[self setRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
// Search
[self setSearchLocalDataLoader:[[UserLocalDataLoader alloc] init]];
[self setSearchRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
// SearchBar
self.tableView.tableHeaderView = self.searchDisplayController.searchBar;
// register cells
[self.searchDisplayController.searchResultsTableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
[self.tableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
[self customizeAppearance];
}
#pragma mark - UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UserCell *cell = (UserCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];;
User * user = nil;
if (tableView == self.tableView){
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
}
else{
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
}
cell.userName.text = user.userName;
NSMutableURLRequest* imageRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:user.userImageURL]];
[imageRequest setValue:@"image/*" forHTTPHeaderField:@"Accept"];
__typeof__(cell) __weak weakCell = cell;
[cell.userImage setImageWithURLRequest: imageRequest
placeholderImage:[User defaultProfileImage]
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (image) {
[weakCell.userImage setImage:image];
}
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
}];
cell.accessoryType = [[self.rowDescriptor.value formValue] isEqual:user.userId] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 73.0f;
}
#pragma mark - UITableViewDelegate
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
User * user = nil;
if (tableView == self.tableView){
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
}
else{
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
}
self.rowDescriptor.value = user;
if (self.popoverController){
[self.popoverController dismissPopoverAnimated:YES];
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
}
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - Helpers
-(void)customizeAppearance
{
[[self navigationItem] setTitle:@"Select a User"];
[self.tableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
[self.tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
[self.searchDisplayController.searchResultsTableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
[self.searchDisplayController.searchResultsTableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
}
@end
@@ -1,8 +1,8 @@
//
// UsersTableViewController.m
// UsersTableViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,223 +23,188 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "UsersTableViewController.h"
#import "UserLocalDataLoader.h"
#import "UserRemoteDataLoader.h"
#import "User+Additions.h"
// AFNetworking
#import <AFNetworking/UIImageView+AFNetworking.h>
class UserCell : UITableViewCell {
lazy var userImage : UIImageView = {
let tempUserImage = UIImageView()
tempUserImage.translatesAutoresizingMaskIntoConstraints = false
tempUserImage.layer.masksToBounds = true
tempUserImage.layer.cornerRadius = 10.0
return tempUserImage
}()
@interface UserCell : UITableViewCell
lazy var userName : UILabel = {
let tempUserName = UILabel()
tempUserName.translatesAutoresizingMaskIntoConstraints = false
tempUserName.font = UIFont.systemFont(ofSize: 15.0)
return tempUserName
}()
@property (nonatomic) UIImageView * userImage;
@property (nonatomic) UILabel * userName;
@end
@implementation UserCell
@synthesize userImage = _userImage;
@synthesize userName = _userName;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// Initialization code
contentView.addSubview(userImage)
contentView.addSubview(userName)
contentView.addConstraints(layoutConstraints())
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
[self.contentView addSubview:self.userImage];
[self.contentView addSubview:self.userName];
}
// MARK: - Layout Constraints
func layoutConstraints() -> [NSLayoutConstraint]{
let views = ["image": self.userImage, "name": self.userName ] as [String : Any]
let metrics = [ "imgSize": 50.0, "margin": 12.0]
[self.contentView addConstraints:[self layoutConstraints]];
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark - Views
-(UIImageView *)userImage
{
if (_userImage) return _userImage;
_userImage = [UIImageView new];
[_userImage setTranslatesAutoresizingMaskIntoConstraints:NO];
_userImage.layer.masksToBounds = YES;
_userImage.layer.cornerRadius = 10.0f;
return _userImage;
}
-(UILabel *)userName
{
if (_userName) return _userName;
_userName = [UILabel new];
[_userName setTranslatesAutoresizingMaskIntoConstraints:NO];
_userName.font = [UIFont fontWithName:@"HelveticaNeue" size:15.f];
return _userName;
}
#pragma mark - Layout Constraints
-(NSArray *)layoutConstraints{
NSMutableArray * result = [NSMutableArray array];
NSDictionary * views = @{ @"image": self.userImage,
@"name": self.userName};
NSDictionary *metrics = @{@"imgSize":@50.0,
@"margin" :@12.0};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
options:NSLayoutFormatAlignAllTop
metrics:metrics
views:views]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[image(imgSize)]"
options:0
metrics:metrics
views:views]];
return result;
}
@end
@interface UsersTableViewController ()
@end
@implementation UsersTableViewController
@synthesize rowDescriptor = _rowDescriptor;
@synthesize popoverController = __popoverController;
static NSString *const kCellIdentifier = @"CellIdentifier";
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self initialize];
}
return self;
}
-(void)initialize
{
// Enable the pagination
self.loadingPagingEnabled = YES;
// Support Search Controller
self.supportSearchController = YES;
[self setLocalDataLoader:[[UserLocalDataLoader alloc] init]];
[self setRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
// Search
[self setSearchLocalDataLoader:[[UserLocalDataLoader alloc] init]];
[self setSearchRemoteDataLoader:[[UserRemoteDataLoader alloc] init]];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
// SearchBar
self.tableView.tableHeaderView = self.searchDisplayController.searchBar;
// register cells
[self.searchDisplayController.searchResultsTableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
[self.tableView registerClass:[UserCell class] forCellReuseIdentifier:kCellIdentifier];
[self customizeAppearance];
}
#pragma mark - UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UserCell *cell = (UserCell *) [tableView dequeueReusableCellWithIdentifier:kCellIdentifier forIndexPath:indexPath];;
User * user = nil;
if (tableView == self.tableView){
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
}
else{
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
var result = NSLayoutConstraint.constraints(withVisualFormat: "H:|-(margin)-[image(imgSize)]-[name]", options:.alignAllTop, metrics: metrics, views: views)
result += NSLayoutConstraint.constraints(withVisualFormat: "V:|-(margin)-[image(imgSize)]", options:NSLayoutFormatOptions(), metrics:metrics, views: views)
return result
}
cell.userName.text = user.userName;
NSMutableURLRequest* imageRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:user.userImageURL]];
[imageRequest setValue:@"image/*" forHTTPHeaderField:@"Accept"];
__typeof__(cell) __weak weakCell = cell;
[cell.userImage setImageWithURLRequest: imageRequest
placeholderImage:[User defaultProfileImage]
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (image) {
[weakCell.userImage setImage:image];
}
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
}];
cell.accessoryType = [[self.rowDescriptor.value formValue] isEqual:user.userId] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 73.0f;
}
#pragma mark - UITableViewDelegate
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
User * user = nil;
if (tableView == self.tableView){
user = (User *)[self.localDataLoader objectAtIndexPath:indexPath];
}
else{
user = (User *)[self.searchLocalDataLoader objectAtIndexPath:indexPath];
}
self.rowDescriptor.value = user;
if (self.popoverController){
[self.popoverController dismissPopoverAnimated:YES];
[self.popoverController.delegate popoverControllerDidDismissPopover:self.popoverController];
}
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]){
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - Helpers
private let _UsersJSONSerializationSharedInstance = UsersJSONSerialization()
-(void)customizeAppearance
{
[[self navigationItem] setTitle:@"Select a User"];
class UsersJSONSerialization {
[self.tableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
[self.tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
lazy var userData : Array<AnyObject>? = {
let dataString =
"[" +
"{\"id\":1,\"name\":\"Apu Nahasapeemapetilon\",\"imageName\":\"Apu_Nahasapeemapetilon.png\"}," +
"{\"id\":7,\"name\":\"Bart Simpsons\",\"imageName\":\"Bart_Simpsons.png\"}," +
"{\"id\":8,\"name\":\"Homer Simpsons\",\"imageName\":\"Homer_Simpsons.png\"}," +
"{\"id\":9,\"name\":\"Lisa Simpsons\",\"imageName\":\"Lisa_Simpsons.png\"}," +
"{\"id\":2,\"name\":\"Maggie Simpsons\",\"imageName\":\"Maggie_Simpsons.png\"}," +
"{\"id\":3,\"name\":\"Marge Simpsons\",\"imageName\":\"Marge_Simpsons.png\"}," +
"{\"id\":4,\"name\":\"Montgomery Burns\",\"imageName\":\"Montgomery_Burns.png\"}," +
"{\"id\":5,\"name\":\"Ned Flanders\",\"imageName\":\"Ned_Flanders.png\"}," +
"{\"id\":6,\"name\":\"Otto Mann\",\"imageName\":\"Otto_Mann.png\"}]"
let jsonData = dataString.data(using: String.Encoding.utf8, allowLossyConversion: true)
do {
let result = try JSONSerialization.jsonObject(with: jsonData!, options: JSONSerialization.ReadingOptions()) as! Array<AnyObject>
return result
}
catch let error as NSError {
print("\(error)")
}
return nil
}()
class var sharedInstance: UsersJSONSerialization {
return _UsersJSONSerializationSharedInstance
}
[self.searchDisplayController.searchResultsTableView setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:1.0]];
[self.searchDisplayController.searchResultsTableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];
}
class User: NSObject, XLFormOptionObject {
let userId: Int
let userName : String
let userImage: String
init(userId: Int, userName: String, userImage: String){
self.userId = userId
self.userImage = userImage
self.userName = userName
}
func formDisplayText() -> String {
return self.userName
}
@end
func formValue() -> Any {
return self.userId as Any
}
}
class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController {
var rowDescriptor : XLFormRowDescriptor?
var popoverController : UIPopoverController?
var userCell : UserCell?
fileprivate let kUserCellIdentifier = "UserCell"
override init(style: UITableViewStyle) {
super.init(style: style);
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: Bundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UserCell.self, forCellReuseIdentifier: kUserCellIdentifier)
tableView.tableFooterView = UIView(frame: CGRect.zero)
}
// MARK: UITableViewDataSource
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return UsersJSONSerialization.sharedInstance.userData!.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: UserCell = tableView.dequeueReusableCell(withIdentifier: self.kUserCellIdentifier, for: indexPath) as! UserCell
let usersData = UsersJSONSerialization.sharedInstance.userData! as! Array<Dictionary<String, AnyObject>>
let userData = usersData[(indexPath as NSIndexPath).row] as Dictionary<String, AnyObject>
let userId = userData["id"] as! Int
cell.userName.text = userData["name"] as? String
cell.userImage.image = UIImage(named: (userData["imageName"] as? String)!)
if let value = rowDescriptor?.value {
cell.accessoryType = ((value as? XLFormOptionObject)?.formValue() as? Int) == userId ? .checkmark : .none
}
return cell;
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 73.0
}
//MARK: UITableViewDelegate
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let usersData = UsersJSONSerialization.sharedInstance.userData! as! Array<Dictionary<String, AnyObject>>
let userData = usersData[(indexPath as NSIndexPath).row] as Dictionary<String, AnyObject>
let user = User(userId: (userData["id"] as! Int), userName: userData["name"] as! String, userImage: userData["imageName"] as! String)
self.rowDescriptor!.value = user;
if let porpOver = self.popoverController {
porpOver.dismiss(animated: true)
porpOver.delegate?.popoverControllerDidDismissPopover!(porpOver)
}
else if parent is UINavigationController {
navigationController?.popViewController(animated: true)
}
}
}
@@ -28,7 +28,7 @@
class ExamplesFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let RealExample = "RealExamples"
static let TextFieldAndTextView = "TextFieldAndTextView"
static let Selectors = "Selectors"
@@ -46,7 +46,7 @@ class ExamplesFormViewController : XLFormViewController {
static let AccessoryView = "Accessory View"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -66,15 +66,15 @@ class ExamplesFormViewController : XLFormViewController {
form = XLFormDescriptor()
section = XLFormSectionDescriptor.formSectionWithTitle("Real examples")
section = XLFormSectionDescriptor.formSection(withTitle: "Real examples")
form.addFormSection(section)
// NativeEventFormViewController
row = XLFormRowDescriptor(tag: Tags.RealExample, rowType: XLFormRowDescriptorTypeButton, title: "iOS Calendar Event Form")
row.action.formSegueIdenfifier = "NativeEventNavigationViewControllerSegue"
row.action.formSegueIdentifier = "NativeEventNavigationViewControllerSegue"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("This form is actually an example")
section = XLFormSectionDescriptor.formSection(withTitle: "This form is actually an example")
section.footerTitle = "ExamplesFormViewController.swift, Select an option to view another example"
form.addFormSection(section)
@@ -87,7 +87,7 @@ class ExamplesFormViewController : XLFormViewController {
// Selectors
row = XLFormRowDescriptor(tag: Tags.Selectors, rowType: XLFormRowDescriptorTypeButton, title: "Selectors")
row.action.formSegueIdenfifier = "SelectorsFormViewControllerSegue"
row.action.formSegueIdentifier = "SelectorsFormViewControllerSegue"
section.addFormRow(row)
@@ -98,11 +98,11 @@ class ExamplesFormViewController : XLFormViewController {
// Others
row = XLFormRowDescriptor(tag: Tags.Othes, rowType: XLFormRowDescriptorTypeButton, title: "Other Rows")
row.action.formSegueIdenfifier = "OthersFormViewControllerSegue"
row.action.formSegueIdentifier = "OthersFormViewControllerSegue"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued example")
section = XLFormSectionDescriptor.formSection(withTitle: "Multivalued example")
form.addFormSection(section)
@@ -123,14 +123,14 @@ class ExamplesFormViewController : XLFormViewController {
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("UI Customization")
section = XLFormSectionDescriptor.formSection(withTitle: "UI Customization")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.UICusomization, rowType: XLFormRowDescriptorTypeButton, title:"UI Customization")
row.action.viewControllerClass = UICustomizationFormViewController.self
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Custom Rows")
section = XLFormSectionDescriptor.formSection(withTitle: "Custom Rows")
form.addFormSection(section)
@@ -138,7 +138,7 @@ class ExamplesFormViewController : XLFormViewController {
row.action.viewControllerClass = CustomRowsViewController.self
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Accessory View")
section = XLFormSectionDescriptor.formSection(withTitle: "Accessory View")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.AccessoryView, rowType: XLFormRowDescriptorTypeButton, title:"Accessory Views")
@@ -146,30 +146,30 @@ class ExamplesFormViewController : XLFormViewController {
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Validation Examples")
section = XLFormSectionDescriptor.formSection(withTitle: "Validation Examples")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Validations, rowType: XLFormRowDescriptorTypeButton, title: "Validation Examples")
row.action.formSegueIdenfifier = "ValidationExamplesFormViewControllerSegue"
row.action.formSegueIdentifier = "ValidationExamplesFormViewControllerSegue"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Using Predicates")
section = XLFormSectionDescriptor.formSection(withTitle: "Using Predicates")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Very basic predicates")
row.action.formSegueIdenfifier = "BasicPredicateViewControllerSegue"
row.action.formSegueIdentifier = "BasicPredicateViewControllerSegue"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Blog Example Hide predicates")
row.action.formSegueIdenfifier = "BlogExampleViewSegue"
row.action.formSegueIdentifier = "BlogExampleViewSegue"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Another example")
row.action.formSegueIdenfifier = "PredicateFormViewControllerSegue"
row.action.formSegueIdentifier = "PredicateFormViewControllerSegue"
section.addFormRow(row)
self.form = form
@@ -66,6 +66,11 @@
"idiom" : "ipad",
"filename" : "xl_appicon_152.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
@@ -2,7 +2,7 @@
// InputsFormViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -25,133 +25,128 @@
class InputsFormViewController : XLFormViewController {
fileprivate struct Tags {
static let Name = "name"
static let Email = "email"
static let Twitter = "twitter"
static let Number = "number"
static let Integer = "integer"
static let Decimal = "decimal"
static let Password = "password"
static let Phone = "phone"
static let Url = "url"
static let ZipCode = "zipCode"
static let TextView = "textView"
static let Notes = "notes"
}
required init(coder aDecoder: NSCoder) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Text Fields")
form.assignFirstResponderOnShow = true
form = XLFormDescriptor.formDescriptorWithTitle("Text Fields") as! XLFormDescriptor;
form.assignFirstResponderOnShow = true;
section = XLFormSectionDescriptor.formSection () as! XLFormSectionDescriptor
form.addFormSection(section);
// Title
row = XLFormRowDescriptor.formRowDescriptorWithTag("title", rowType: XLFormRowDescriptorTypeText) as! XLFormRowDescriptor
row.cellConfigAtConfigure["textField.placeholder"] = "Title"
row.required = true
section.addFormRow(row)
// Location
row = XLFormRowDescriptor.formRowDescriptorWithTag("location", rowType: XLFormRowDescriptorTypeText) as! XLFormRowDescriptor
row.cellConfigAtConfigure["textField.placeholder"] = "Location"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection() as! XLFormSectionDescriptor
section = XLFormSectionDescriptor.formSection(withTitle: "TextField Types")
section.footerTitle = "This is a long text that will appear on section footer"
form.addFormSection(section)
// All-day
row = XLFormRowDescriptor.formRowDescriptorWithTag("all-day", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "All-day") as! XLFormRowDescriptor
// Name
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title: "Name")
row.isRequired = true
section.addFormRow(row)
// Starts
row = XLFormRowDescriptor.formRowDescriptorWithTag("starts", rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Starts") as! XLFormRowDescriptor
row.value = NSDate(timeIntervalSinceNow: 60*60*24)
// Email
row = XLFormRowDescriptor(tag: Tags.Email, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
// validate the email
row.addValidator(XLFormValidator.email())
section.addFormRow(row)
// Ends
row = XLFormRowDescriptor.formRowDescriptorWithTag("ends", rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Ends") as! XLFormRowDescriptor
row.value = NSDate(timeIntervalSinceNow: 60*60*25)
// Twitter
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
row.disabled = NSNumber(value: true as Bool)
row.value = "@no_editable"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection() as! XLFormSectionDescriptor
// Zip Code
row = XLFormRowDescriptor(tag: Tags.ZipCode, rowType: XLFormRowDescriptorTypeZipCode, title: "Zip Code")
section.addFormRow(row)
// Number
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeNumber, title: "Number")
section.addFormRow(row)
// Integer
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title: "Integer")
section.addFormRow(row)
// Decimal
row = XLFormRowDescriptor(tag: Tags.Decimal, rowType: XLFormRowDescriptorTypeDecimal, title: "Decimal")
section.addFormRow(row)
// Password
row = XLFormRowDescriptor(tag: Tags.Password, rowType: XLFormRowDescriptorTypePassword, title: "Password")
section.addFormRow(row)
// Phone
row = XLFormRowDescriptor(tag: Tags.Phone, rowType: XLFormRowDescriptorTypePhone, title: "Phone")
section.addFormRow(row)
// Url
row = XLFormRowDescriptor(tag: Tags.Url, rowType: XLFormRowDescriptorTypeURL, title: "Url")
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection()
form.addFormSection(section)
// Repeat
row = XLFormRowDescriptor.formRowDescriptorWithTag("repeat", rowType:XLFormRowDescriptorTypeSelectorPush, title:"Repeat") as! XLFormRowDescriptor
row.value = XLFormOptionsObject(value: 0, displayText: "Never")
row.selectorTitle = "Repeat"
row.selectorOptions = [XLFormOptionsObject(value: 0, displayText: "Never"),
XLFormOptionsObject(value: 1, displayText: "Every Day"),
XLFormOptionsObject(value: 2, displayText: "Every Week"),
XLFormOptionsObject(value: 3, displayText: "Every 2 Weeks"),
XLFormOptionsObject(value: 4, displayText: "Every Month"),
XLFormOptionsObject(value: 5, displayText: "Every Year")]
// TextView
row = XLFormRowDescriptor(tag: Tags.TextView, rowType: XLFormRowDescriptorTypeTextView)
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection() as! XLFormSectionDescriptor
section = XLFormSectionDescriptor.formSection(withTitle: "TextView With Label Example")
form.addFormSection(section)
// Alert
row = XLFormRowDescriptor.formRowDescriptorWithTag("alert", rowType:XLFormRowDescriptorTypeSelectorPush, title:"Alert") as! XLFormRowDescriptor
row.value = XLFormOptionsObject(value: 0, displayText: "None")
row.selectorTitle = "Event Alert"
row.selectorOptions = [
XLFormOptionsObject(value: 0, displayText: "None"),
XLFormOptionsObject(value: 1, displayText: "At time of event"),
XLFormOptionsObject(value: 2, displayText: "5 minutes before"),
XLFormOptionsObject(value: 3, displayText: "15 minutes before"),
XLFormOptionsObject(value: 4, displayText: "30 minutes before"),
XLFormOptionsObject(value: 5, displayText: "1 hour before"),
XLFormOptionsObject(value: 6, displayText: "2 hours before"),
XLFormOptionsObject(value: 7, displayText: "1 day before"),
XLFormOptionsObject(value: 8, displayText: "2 days before")]
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeTextView, title: "Notes")
section.addFormRow(row)
self.form = form
section = XLFormSectionDescriptor.formSection() as! XLFormSectionDescriptor
form.addFormSection(section)
// Show As
row = XLFormRowDescriptor.formRowDescriptorWithTag("showAs", rowType:XLFormRowDescriptorTypeSelectorPush, title:"Show As") as! XLFormRowDescriptor
row.value = XLFormOptionsObject(value: 0, displayText: "Busy")
row.selectorTitle = "Show As"
row.selectorOptions = [XLFormOptionsObject(value: 0, displayText:"Busy"),
XLFormOptionsObject(value: 1, displayText:"Free")]
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection() as! XLFormSectionDescriptor
form.addFormSection(section)
// URL
row = XLFormRowDescriptor.formRowDescriptorWithTag("url", rowType:XLFormRowDescriptorTypeURL) as! XLFormRowDescriptor
row.cellConfigAtConfigure["textField.placeholder"] = "URL"
section.addFormRow(row)
// Notes
row = XLFormRowDescriptor.formRowDescriptorWithTag("notes", rowType:XLFormRowDescriptorTypeTextView) as! XLFormRowDescriptor
row.cellConfigAtConfigure["textView.placeholder"] = "Notes"
section.addFormRow(row)
self.form = form;
}
override func viewDidLoad() {
override func viewDidLoad()
{
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Save, target: self, action: "savePressed:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(InputsFormViewController.savePressed(_:)))
}
func savePressed(button: UIBarButtonItem){
func savePressed(_ button: UIBarButtonItem)
{
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
if (validationErrors.count > 0){
self.showFormValidationError(validationErrors.first);
return;
self.showFormValidationError(validationErrors.first)
return
}
self.tableView.endEditing(true)
// let alertView = UIAlertView( alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil) message:@"No errors found" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
// [alertView show];
let alertView = UIAlertView(title: "Valid Form", message: "No errors found", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
}
@@ -31,7 +31,7 @@ class MultivaluedFormViewController : XLFormViewController {
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -45,7 +45,7 @@ class MultivaluedFormViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Examples")
// Multivalued section
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued TextField", sectionOptions:XLFormSectionOptions.CanReorder.union(.CanInsert).union(.CanDelete), sectionInsertMode:.Button)
section = XLFormSectionDescriptor.formSection(withTitle: "Multivalued TextField", sectionOptions:XLFormSectionOptions.canReorder.union(.canInsert).union(.canDelete), sectionInsertMode:.button)
section.multivaluedAddButton!.title = "Add New Tag"
section.footerTitle = "XLFormSectionInsertModeButton sectionType adds a 'Add Item' (Add New Tag) button row as last cell."
// set up the row template
@@ -56,7 +56,7 @@ class MultivaluedFormViewController : XLFormViewController {
form.addFormSection(section)
// Another Multivalued section
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued ActionSheet Selector example", sectionOptions:XLFormSectionOptions.CanInsert.union(.CanDelete))
section = XLFormSectionDescriptor.formSection(withTitle: "Multivalued ActionSheet Selector example", sectionOptions:XLFormSectionOptions.canInsert.union(.canDelete))
section.footerTitle = "XLFormSectionInsertModeLastRow sectionType adds a '+' icon inside last table view cell allowing us to add a new row."
form.addFormSection(section)
row = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeSelectorActionSheet, title: "Tap to select..")
@@ -65,7 +65,7 @@ class MultivaluedFormViewController : XLFormViewController {
// Another one
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued Push Selector example", sectionOptions: XLFormSectionOptions.CanInsert.union(.CanDelete).union(.CanReorder), sectionInsertMode: .Button)
section = XLFormSectionDescriptor.formSection(withTitle: "Multivalued Push Selector example", sectionOptions: XLFormSectionOptions.canInsert.union(.canDelete).union(.canReorder), sectionInsertMode: .button)
section.footerTitle = "MultivaluedFormViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Tap to select )..")
@@ -78,30 +78,30 @@ class MultivaluedFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Edit, target: self, action: "addDidTouch:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(MultivaluedFormViewController.addDidTouch(_:)))
}
//MARK: - Actions
func addDidTouch(sender: UIBarButtonItem) {
let actionSheet = UIActionSheet(title: nil, delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Remove Last Section", otherButtonTitles: "Add a section at the end", self.form!.disabled ? "Enable Form" : "Disable Form")
actionSheet.showInView(view)
func addDidTouch(_ sender: UIBarButtonItem) {
let actionSheet = UIActionSheet(title: nil, delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Remove Last Section", otherButtonTitles: "Add a section at the end", self.form!.isDisabled ? "Enable Form" : "Disable Form")
actionSheet.show(in: view)
}
//MARK: - UIActionSheetDelegate
override func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
override func actionSheet(_ actionSheet: UIActionSheet, clickedButtonAt buttonIndex: Int) {
if actionSheet.destructiveButtonIndex == buttonIndex {
if form.formSections.count > 0 {
// remove last section
form.removeFormSectionAtIndex(UInt(form.formSections.count - 1))
form.removeFormSection(at: UInt(form.formSections.count - 1))
}
}
else if actionSheet.buttonTitleAtIndex(buttonIndex) == "Add a section at the end" {
else if actionSheet.buttonTitle(at: buttonIndex) == "Add a section at the end" {
// add a new section
// let dateString = NSDateFormatter.localizedStringFromDate(NSDate(), dateStyle: NSDateFormatterStyle.ShortStyle, timeStyle: NSDateFormatterStyle.ShortStyle)
let newSection = XLFormSectionDescriptor.formSectionWithTitle("Section created at \(NSDateFormatter.localizedStringFromDate(NSDate(), dateStyle: NSDateFormatterStyle.ShortStyle, timeStyle: NSDateFormatterStyle.ShortStyle))", sectionOptions:XLFormSectionOptions.CanInsert.union(.CanDelete))
let newSection = XLFormSectionDescriptor.formSection(withTitle: "Section created at \(DateFormatter.localizedString(from: Date(), dateStyle: DateFormatter.Style.short, timeStyle: DateFormatter.Style.short))", sectionOptions:XLFormSectionOptions.canInsert.union(.canDelete))
newSection.multivaluedTag = "multivaluedPushSelector_\(self.form.formSections.count)"
let newRow = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Tap to select )..")
newRow.selectorOptions = ["Option 1", "Option 2", "Option 3"]
@@ -109,7 +109,7 @@ class MultivaluedFormViewController : XLFormViewController {
form.addFormSection(newSection)
}
else {
form.disabled = !self.form.disabled
form.isDisabled = !self.form.isDisabled
tableView.endEditing(true)
tableView.reloadData()
}
@@ -126,7 +126,7 @@ class MultivaluedOnlyReorderViewController : XLFormViewController {
self.initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
@@ -143,29 +143,31 @@ class MultivaluedOnlyReorderViewController : XLFormViewController {
form = XLFormDescriptor(title: "Only Reorder Examples")
// Multivalued Section with inline rows - section set up to support only reordering
section = XLFormSectionDescriptor.formSectionWithTitle("Reordering Inline Rows",
sectionOptions:.CanReorder)
section = XLFormSectionDescriptor.formSection(withTitle: "Reordering Inline Rows",
sectionOptions:.canReorder)
section.footerTitle = "XLFormRowDescriptorTypeDateInline row type"
form.addFormSection(section)
var idx = 0
for listItem in list {
let timeIntervalSinceNow = NSTimeInterval(secondsPerDay * ++idx)
idx += 1
let timeIntervalSinceNow = TimeInterval(secondsPerDay * idx)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeDateInline, title: listItem)
row.value = NSDate(timeIntervalSinceNow:timeIntervalSinceNow)
row.value = Date(timeIntervalSinceNow:timeIntervalSinceNow)
section.addFormRow(row)
}
// Multivalued Section with common rows - section set up to support only reordering
section = XLFormSectionDescriptor.formSectionWithTitle("Reordering Rows", sectionOptions:.CanReorder)
section = XLFormSectionDescriptor.formSection(withTitle: "Reordering Rows", sectionOptions:.canReorder)
section.footerTitle = "XLFormRowDescriptorTypeInfo row type"
form.addFormSection(section)
idx = 0
for listItem in list {
let timeIntervalSinceNow = NSTimeInterval(secondsPerDay * ++idx)
idx += 1
let timeIntervalSinceNow = TimeInterval(secondsPerDay * idx)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeInfo, title: listItem)
row.value = NSDateFormatter.localizedStringFromDate(NSDate(timeIntervalSinceNow:timeIntervalSinceNow), dateStyle: .MediumStyle, timeStyle: .NoStyle)
row.value = DateFormatter.localizedString(from: Date(timeIntervalSinceNow:timeIntervalSinceNow), dateStyle: .medium, timeStyle: .none)
section.addFormRow(row)
}
@@ -182,7 +184,7 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
@@ -197,7 +199,7 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Only Insert")
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton", sectionOptions:.CanInsert, sectionInsertMode:.Button)
section = XLFormSectionDescriptor.formSection(withTitle: "XLFormSectionInsertModeButton", sectionOptions:.canInsert, sectionInsertMode:.button)
form.addFormSection(section)
@@ -205,15 +207,15 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
row.cellConfig["textField.placeholder"] = "Add a new tag"
section.multivaluedRowTemplate = row
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton With Inline Cells", sectionOptions:.CanInsert, sectionInsertMode:.Button)
section = XLFormSectionDescriptor.formSection(withTitle: "XLFormSectionInsertModeButton With Inline Cells", sectionOptions:.canInsert, sectionInsertMode:.button)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeDateInline)
row.value = NSDate()
row.value = Date()
row.title = "Date"
section.multivaluedRowTemplate = row
form.addFormSection(section)
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeLastRow",
sectionOptions:.CanInsert, sectionInsertMode:.LastRow)
section = XLFormSectionDescriptor.formSection(withTitle: "XLFormSectionInsertModeLastRow",
sectionOptions:.canInsert, sectionInsertMode:.lastRow)
form.addFormSection(section)
for tag in nameList {
// add a row to the section, the row will be used to crete new rows.
@@ -233,19 +235,19 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: .Plain, target: self, action: "toggleEditing:")
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: .plain, target: self, action: #selector(MultivaluedOnlyDeleteViewController.toggleEditing(_:)))
}
func toggleEditing(sender : UIBarButtonItem) {
tableView.setEditing(!tableView.editing, animated: true)
sender.title = tableView.editing ? "Editing" : "Not Editing"
func toggleEditing(_ sender : UIBarButtonItem) {
tableView.setEditing(!tableView.isEditing, animated: true)
sender.title = tableView.isEditing ? "Editing" : "Not Editing"
}
func initializeForm() {
@@ -258,7 +260,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Only Delete")
section = XLFormSectionDescriptor.formSectionWithTitle("", sectionOptions:.CanDelete)
section = XLFormSectionDescriptor.formSection(withTitle: "", sectionOptions:.canDelete)
section.footerTitle = "you can swipe to delete when table.editing = NO (Not Editing)"
form.addFormSection(section)
@@ -271,7 +273,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
}
// Multivalued Section with inline row.
section = XLFormSectionDescriptor.formSectionWithTitle("", sectionOptions:.CanDelete)
section = XLFormSectionDescriptor.formSection(withTitle: "", sectionOptions:.canDelete)
section.footerTitle = "you can swipe to delete when table.editing = NO (Not Editing)"
form.addFormSection(section)
@@ -50,10 +50,10 @@ class XLFormCustomCell : XLFormBaseCell {
}
}
override func formDescriptorCellDidSelectedWithFormController(controller: XLFormViewController!) {
override func formDescriptorCellDidSelected(withForm controller: XLFormViewController!) {
// custom code here
// i.e new behaviour when cell has been selected
if let string = rowDescriptor?.value as? String where string == "Am a custom cell, select me!" {
if let string = rowDescriptor?.value as? String , string == "Am a custom cell, select me!" {
self.rowDescriptor?.value = string
}
else {
@@ -61,7 +61,7 @@ class XLFormCustomCell : XLFormBaseCell {
}
update()
controller.tableView.selectRowAtIndexPath(nil, animated: true, scrollPosition: .None)
controller.tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
}
}
@@ -27,7 +27,7 @@ import MapKit
class OthersFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let SwitchBool = "switchBool"
static let SwitchCheck = "switchCheck"
static let StepCounter = "stepCounter"
@@ -46,12 +46,10 @@ class OthersFormViewController : XLFormViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
@@ -63,7 +61,7 @@ class OthersFormViewController : XLFormViewController {
form = XLFormDescriptor(title: "Other Cells")
section = XLFormSectionDescriptor.formSectionWithTitle("Other Cells")
section = XLFormSectionDescriptor.formSection(withTitle: "Other Cells")
section.footerTitle = "OthersFormViewController.swift"
form.addFormSection(section)
@@ -81,6 +79,12 @@ class OthersFormViewController : XLFormViewController {
row.selectorOptions = ["Apple", "Orange", "Pear"]
row.value = "Pear"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.SegmentedControl, rowType: XLFormRowDescriptorTypeSegmentedInline, title: "Fruits Inline")
row.selectorOptions = ["Apple", "Orange", "Pear"]
row.value = "Pear"
section.addFormRow(row)
// Slider
@@ -99,29 +103,29 @@ class OthersFormViewController : XLFormViewController {
// Info cell
row = XLFormRowDescriptor(tag: Tags.Info, rowType: XLFormRowDescriptorTypeInfo)
row.title = "Version"
row.value = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"]
row.value = Bundle.main.infoDictionary!["CFBundleShortVersionString"]
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Buttons")
section = XLFormSectionDescriptor.formSection(withTitle: "Buttons")
section.footerTitle = "Blue buttons will show a message when Switch is ON"
form.addFormSection(section)
// Button
row = XLFormRowDescriptor(tag: Tags.Button, rowType: XLFormRowDescriptorTypeButton, title: "Button")
row.cellConfig["textLabel.textColor"] = UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0)
row.action.formSelector = "didTouchButton:"
row.action.formSelector = #selector(OthersFormViewController.didTouchButton(_:))
section.addFormRow(row)
// Left Button
row = XLFormRowDescriptor(tag: Tags.ButtonLeftAligned, rowType: XLFormRowDescriptorTypeButton, title: "Button with Block")
row.cellConfig["textLabel.textColor"] = UIColor(red: 0.0, green: 122.0/255.0, blue: 1.0, alpha: 1.0)
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.Left.rawValue
row.cellConfig["accessoryType"] = UITableViewCellAccessoryType.DisclosureIndicator.rawValue
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.left.rawValue
row.cellConfig["accessoryType"] = UITableViewCellAccessoryType.disclosureIndicator.rawValue
row.action.formBlock = { [weak self] (sender: XLFormRowDescriptor!) -> Void in
let switchRow = sender.sectionDescriptor.formDescriptor!.formRowWithTag(Tags.SwitchBool)!
if let value = switchRow.value where value.boolValue == true {
let switchRow = sender.sectionDescriptor.formDescriptor!.formRow(withTag: Tags.SwitchBool)!
if let value = switchRow.value , (value as AnyObject).boolValue == true {
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
@@ -140,7 +144,7 @@ class OthersFormViewController : XLFormViewController {
// Button with SegueId
row = XLFormRowDescriptor(tag: Tags.ButtonWithSegueId, rowType: XLFormRowDescriptorTypeButton, title: "Button with Segue Idenfifier")
row.action.formSegueIdenfifier = "MapViewControllerSegue"
row.action.formSegueIdentifier = "MapViewControllerSegue"
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
@@ -160,9 +164,8 @@ class OthersFormViewController : XLFormViewController {
self.form = form
}
func didTouchButton(sender: XLFormRowDescriptor) {
if sender.sectionDescriptor.formDescriptor.formRowWithTag(Tags.SwitchBool)?.value?.boolValue == true{
func didTouchButton(_ sender: XLFormRowDescriptor) {
if (sender.sectionDescriptor.formDescriptor.formRow(withTag: Tags.SwitchBool)?.value as AnyObject).boolValue == true{
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
@@ -171,15 +174,18 @@ class OthersFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
initializeForm()
let barButton = UIBarButtonItem(title: "Disable", style: .plain, target: self, action: #selector(OthersFormViewController.disableEnable(_:)))
barButton.possibleTitles = Set(["Disable", "Enable"])
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem) {
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
func disableEnable(_ button : UIBarButtonItem) {
form.isDisabled = !form.isDisabled
button.title = form.isDisabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
@@ -26,7 +26,7 @@
class BasicPredicateViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let HideRow = "tag1"
static let HideSection = "tag2"
@@ -35,7 +35,7 @@ class BasicPredicateViewController : XLFormViewController {
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -1,8 +1,8 @@
//
// BlogExampleViewController.m
// BlogExampleViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,87 +23,67 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "BlogExampleViewController.h"
class BlogExampleViewController : XLFormViewController {
NSString *const kHobbies = @"hobbies";
NSString *const kSport = @"sport";
NSString *const kFilm = @"films1";
NSString *const kFilm2 = @"films2";
NSString *const kMusic = @"music";
@interface BlogExampleViewController ()
@end
@implementation BlogExampleViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
fileprivate struct Tags {
static let Hobbies = "hobbies"
static let Sport = "sport"
static let Film = "films1"
static let Film2 = "films2"
static let Music = "music"
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initializeForm];
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
return self;
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Blog Example: Hobbies")
section = XLFormSectionDescriptor()
section.title = "Hobbies"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Hobbies, rowType: XLFormRowDescriptorTypeMultipleSelector, title:"Select Hobbies")
row.selectorOptions = ["Sport", "Music", "Films"]
row.value = []
section.addFormRow(row)
section = XLFormSectionDescriptor()
section.title = "Some more questions"
section.hidden = NSPredicate(format: "$\(row.description).value.@count == 0")
section.footerTitle = "BlogExampleViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Sport, rowType: XLFormRowDescriptorTypeTextView, title:"Your favourite sportsman?")
row.hidden = "NOT $\(Tags.Hobbies).value contains 'Sport'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Film, rowType:XLFormRowDescriptorTypeTextView, title: "Your favourite film?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Film2, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite actor?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Films'"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Music, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite singer?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Music'"
section.addFormRow(row)
self.form = form
}
}
- (void)initializeForm
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Blog Example: Hobbies"];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Hobbies"];
[form addFormSection:section];
XLFormRowDescriptor* hobbyRow = [XLFormRowDescriptor formRowDescriptorWithTag:kHobbies
rowType:XLFormRowDescriptorTypeMultipleSelector
title:@"Select Hobbies"];
hobbyRow.selectorOptions = @[@"Sport", @"Music", @"Films"];
hobbyRow.value = @[];
[section addFormRow:hobbyRow];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Some more questions"];
section.hidden = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"$%@.value.@count = 0", hobbyRow]];
section.footerTitle = @"BlogExampleViewController.m";
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSport
rowType:XLFormRowDescriptorTypeTextView
title:@"Your favourite sportsman?"];
row.hidden = [NSString stringWithFormat:@"NOT $%@.value contains 'Sport'", hobbyRow];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kFilm
rowType:XLFormRowDescriptorTypeTextView
title:@"Your favourite film?"];
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Films'", hobbyRow];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kFilm2
rowType:XLFormRowDescriptorTypeTextView
title:@"Your favourite actor?"];
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Films'", hobbyRow];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kMusic
rowType:XLFormRowDescriptorTypeTextView
title:@"Your favourite singer?"];
row.hidden = [NSString stringWithFormat:@"NOT $%@ contains 'Music'", hobbyRow];
[section addFormRow:row];
self.form = form;
}
@end
@@ -1,8 +1,8 @@
//
// PredicateFormViewController.m
// PredicateFormViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
// Copyright (c) 2014-2015 Xmartlabs ( http://xmartlabs.com )
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,91 +23,99 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
NSString *const kPred = @"pred";
NSString *const kPredDep = @"preddep";
NSString *const kPredDep2 = @"preddep2";
#import "PredicateFormViewController.h"
class PredicateFormViewController : XLFormViewController {
@implementation PredicateFormViewController
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initializeForm];
fileprivate struct Tags {
static let Text = "text"
static let Integer = "integer"
static let Switch = "switch"
static let Date = "date"
static let Account = "account"
}
return self;
}
- (instancetype)init
{
self = [super init];
if (self) {
[self initializeForm];
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
return self;
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Predicates example")
section = XLFormSectionDescriptor()
section.title = "Independent rows"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Text, rowType: XLFormRowDescriptorTypeAccount, title:"Text")
row.cellConfigAtConfigure["textField.placeholder"] = "Type disable"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title:"Integer")
row.hidden = NSPredicate(format: "$\(Tags.Switch).value==0")
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Switch, rowType: XLFormRowDescriptorTypeBooleanSwitch, title:"Boolean")
row.value = true
section.addFormRow(row)
form.addFormSection(section)
section = XLFormSectionDescriptor()
section.title = "Dependent section"
section.footerTitle = "Type disable in the textfield, a number between 18 and 60 in the integer field or use the switch to disable the last row. By doing all three the last section will hide.\nThe integer field hides when the boolean switch is set to 0."
form.addFormSection(section)
// Predicate Disabling
row = XLFormRowDescriptor(tag: Tags.Date, rowType: XLFormRowDescriptorTypeDateInline, title:"Disabled")
row.value = Date()
section.addFormRow(row)
row.disabled = NSPredicate(format: "$\(Tags.Text).value contains[c] 'disable' OR ($\(Tags.Integer).value between {18, 60}) OR ($\(Tags.Switch).value == 0)")
section.hidden = NSPredicate(format: "($\(Tags.Text).value contains[c] 'disable') AND ($\(Tags.Integer).value between {18, 60}) AND ($\(Tags.Switch).value == 0)")
section = XLFormSectionDescriptor()
section.title = "More predicates..."
section.footerTitle = "This row hides when the row of the previous section is disabled and the textfield in the first section contains \"out\"\n\nPredicateFormViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: "thirds", rowType:XLFormRowDescriptorTypeAccount, title:"Account")
section.addFormRow(row)
row.hidden = NSPredicate(format: "$\(Tags.Date).isDisabled == 1 AND $\(Tags.Text).value contains[c] 'Out'")
row.onChangeBlock = { [weak self] oldValue, newValue, _ in
let noValue = "No Value"
let message = "Old value: \(oldValue ?? noValue), New value: \(newValue ?? noValue)"
let alertView = UIAlertController(title: "Account Field changed", message: message, preferredStyle: .actionSheet)
alertView.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self?.navigationController?.present(alertView, animated: true, completion: nil)
}
self.form = form
}
}
- (void)initializeForm
{
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
XLFormRowDescriptor * pred, *pred3, *pred4;
form = [XLFormDescriptor formDescriptorWithTitle:@"Predicates example"];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Independent rows"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredDep rowType:XLFormRowDescriptorTypeAccount title:@"Text"];
[row.cellConfigAtConfigure setObject:@"Type disable" forKey:@"textField.placeholder"];
pred = row;
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredDep2 rowType:XLFormRowDescriptorTypeInteger title:@"Integer"];
row.hidden = [NSString stringWithFormat:@"$switch==0"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"switch" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Boolean"];
row.value = @1;
pred3 = row;
[section addFormRow:row];
[form addFormSection:section];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Dependent section"];
section.footerTitle = @"Type disable in the textfield, a number between 18 and 60 in the integer field or use the switch to disable the last row. By doing all three the last section will hide.\nThe integer field hides when the boolean switch is set to 0.";
[form addFormSection:section];
// Predicate Disabling
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPred rowType:XLFormRowDescriptorTypeDateInline title:@"Disabled"];
row.value = [NSDate new];
[section addFormRow:row];
row.disabled = [NSString stringWithFormat:@"$%@ contains[c] 'disable' OR ($%@.value between {18, 60}) OR ($%@.value == 0)", pred, kPredDep2, pred3];
//[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"($%@.value contains[c] %%@) OR ($%@.value between {18, 60}) OR ($%@.value == 0)", pred, pred2, pred3], @"disable"] ];
pred4 = row;
section.hidden = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"($%@.value contains[c] 'disable') AND ($%@.value between {18, 60}) AND ($%@.value == 0)", pred, kPredDep2, pred3]];
section = [XLFormSectionDescriptor formSectionWithTitle:@"More predicates..."];
section.footerTitle = @"This row hides when the row of the previous section is disabled and the textfield in the first section contains \"out\"\n\nPredicateFormViewController.m";
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"thirds" rowType:XLFormRowDescriptorTypeAccount title:@"Account"];
[section addFormRow:row];
row.hidden = [NSString stringWithFormat:@"$%@.isDisabled == 1 AND $%@.value contains[c] 'Out'", pred4, pred];
self.form = form;
}
@end
@@ -31,7 +31,7 @@ class NativeEventFormViewController : XLFormViewController {
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -50,7 +50,7 @@ class NativeEventFormViewController : XLFormViewController {
// Title
row = XLFormRowDescriptor(tag: "title", rowType: XLFormRowDescriptorTypeText)
row.cellConfigAtConfigure["textField.placeholder"] = "Title"
row.required = true
row.isRequired = true
section.addFormRow(row)
// Location
@@ -67,12 +67,12 @@ class NativeEventFormViewController : XLFormViewController {
// Starts
row = XLFormRowDescriptor(tag: "starts", rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Starts")
row.value = NSDate(timeIntervalSinceNow: 60*60*24)
row.value = Date(timeIntervalSinceNow: 60*60*24)
section.addFormRow(row)
// Ends
row = XLFormRowDescriptor(tag: "ends", rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Ends")
row.value = NSDate(timeIntervalSinceNow: 60*60*25)
row.value = Date(timeIntervalSinceNow: 60*60*25)
section.addFormRow(row)
section = XLFormSectionDescriptor.formSection()
@@ -139,83 +139,83 @@ class NativeEventFormViewController : XLFormViewController {
override func viewDidLoad(){
super.viewDidLoad()
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: "cancelPressed:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "savePressed:")
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(NativeEventFormViewController.cancelPressed(_:)))
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save, target: self, action: #selector(NativeEventFormViewController.savePressed(_:)))
}
// MARK: XLFormDescriptorDelegate
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == "alert" {
if !formRow.value!.valueData().isEqual(0) && oldValue.valueData().isEqual(0) {
if !((formRow.value! as AnyObject).valueData() as AnyObject).isEqual(0) && ((oldValue as AnyObject).valueData() as AnyObject).isEqual(0) {
let newRow = formRow.copy() as! XLFormRowDescriptor
newRow.tag = "secondAlert"
newRow.title = "Second Alert"
form.addFormRow(newRow, afterRow:formRow)
}
else if !oldValue.valueData().isEqual(0) && newValue.valueData().isEqual(0) {
form.removeFormRowWithTag("secondAlert")
else if !((oldValue as AnyObject).valueData() as AnyObject).isEqual(0) && ((newValue as AnyObject).valueData() as AnyObject).isEqual(0) {
form.removeFormRow(withTag: "secondAlert")
}
}
else if formRow.tag == "all-day" {
let startDateDescriptor = form.formRowWithTag("starts")!
let endDateDescriptor = form.formRowWithTag("ends")!
let dateStartCell: XLFormDateCell = startDateDescriptor.cellForFormController(self) as! XLFormDateCell
let dateEndCell: XLFormDateCell = endDateDescriptor.cellForFormController(self) as! XLFormDateCell
if formRow.value!.valueData() as? Bool == true {
let startDateDescriptor = form.formRow(withTag: "starts")!
let endDateDescriptor = form.formRow(withTag: "ends")!
let dateStartCell: XLFormDateCell = startDateDescriptor.cell(forForm: self) as! XLFormDateCell
let dateEndCell: XLFormDateCell = endDateDescriptor.cell(forForm: self) as! XLFormDateCell
if (formRow.value! as AnyObject).valueData() as? Bool == true {
startDateDescriptor.valueTransformer = DateValueTrasformer.self
endDateDescriptor.valueTransformer = DateValueTrasformer.self
dateStartCell.formDatePickerMode = .Date
dateEndCell.formDatePickerMode = .Date
dateStartCell.formDatePickerMode = .date
dateEndCell.formDatePickerMode = .date
}
else{
startDateDescriptor.valueTransformer = DateTimeValueTrasformer.self
endDateDescriptor.valueTransformer = DateTimeValueTrasformer.self
dateStartCell.formDatePickerMode = .DateTime
dateEndCell.formDatePickerMode = .DateTime
dateStartCell.formDatePickerMode = .dateTime
dateEndCell.formDatePickerMode = .dateTime
}
updateFormRow(startDateDescriptor)
updateFormRow(endDateDescriptor)
}
else if formRow.tag == "starts" {
let startDateDescriptor = form.formRowWithTag("starts")!
let endDateDescriptor = form.formRowWithTag("ends")!
if startDateDescriptor.value!.compare(endDateDescriptor.value as! NSDate) == .OrderedDescending {
let startDateDescriptor = form.formRow(withTag: "starts")!
let endDateDescriptor = form.formRow(withTag: "ends")!
if (startDateDescriptor.value! as AnyObject).compare(endDateDescriptor.value as! Date) == .orderedDescending {
// startDateDescriptor is later than endDateDescriptor
endDateDescriptor.value = NSDate(timeInterval: 60*60*24, sinceDate: startDateDescriptor.value as! NSDate)
endDateDescriptor.cellConfig.removeObjectForKey("detailTextLabel.attributedText")
endDateDescriptor.value = Date(timeInterval: 60*60*24, since: startDateDescriptor.value as! Date)
endDateDescriptor.cellConfig.removeObject(forKey: "detailTextLabel.attributedText")
updateFormRow(endDateDescriptor)
}
}
else if formRow.tag == "ends" {
let startDateDescriptor = form.formRowWithTag("starts")!
let endDateDescriptor = form.formRowWithTag("ends")!
let dateEndCell = endDateDescriptor.cellForFormController(self) as! XLFormDateCell
if startDateDescriptor.value!.compare(endDateDescriptor.value as! NSDate) == .OrderedDescending {
let startDateDescriptor = form.formRow(withTag: "starts")!
let endDateDescriptor = form.formRow(withTag: "ends")!
let dateEndCell = endDateDescriptor.cell(forForm: self) as! XLFormDateCell
if (startDateDescriptor.value! as AnyObject).compare(endDateDescriptor.value as! Date) == .orderedDescending {
// startDateDescriptor is later than endDateDescriptor
dateEndCell.update()
let newDetailText = dateEndCell.detailTextLabel!.text!
let strikeThroughAttribute = [NSStrikethroughStyleAttributeName : NSUnderlineStyle.StyleSingle.rawValue]
let strikeThroughAttribute = [NSStrikethroughStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue]
let strikeThroughText = NSAttributedString(string: newDetailText, attributes: strikeThroughAttribute)
endDateDescriptor.cellConfig["detailTextLabel.attributedText"] = strikeThroughText
updateFormRow(endDateDescriptor)
}
else{
let endDateDescriptor = self.form.formRowWithTag("ends")!
endDateDescriptor.cellConfig.removeObjectForKey("detailTextLabel.attributedText")
let endDateDescriptor = self.form.formRow(withTag: "ends")!
endDateDescriptor.cellConfig.removeObject(forKey: "detailTextLabel.attributedText")
updateFormRow(endDateDescriptor)
}
}
}
func cancelPressed(button: UIBarButtonItem){
dismissViewControllerAnimated(true, completion: nil)
func cancelPressed(_ button: UIBarButtonItem){
dismiss(animated: true, completion: nil)
}
func savePressed(button: UIBarButtonItem){
func savePressed(_ button: UIBarButtonItem){
let validationErrors : Array<NSError> = formValidationErrors() as! Array<NSError>
if (validationErrors.count > 0){
showFormValidationError(validationErrors.first)
@@ -230,7 +230,7 @@ class NativeEventNavigationViewController : UINavigationController {
override func viewDidLoad(){
super.viewDidLoad()
view.tintColor = .redColor()
view.tintColor = .red
}
}
@@ -27,7 +27,7 @@ import MapKit
// Mark - NSValueTransformer
class NSArrayValueTrasformer : NSValueTransformer {
class NSArrayValueTrasformer : ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSString.self
@@ -37,7 +37,7 @@ class NSArrayValueTrasformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
override func transformedValue(_ value: Any?) -> Any? {
if let arrayValue = value as? Array<AnyObject> {
return String(format: "%d Item%@", arrayValue.count, arrayValue.count > 1 ? "s" : "")
}
@@ -48,7 +48,7 @@ class NSArrayValueTrasformer : NSValueTransformer {
}
}
class ISOLanguageCodesValueTranformer : NSValueTransformer {
class ISOLanguageCodesValueTranformer : ValueTransformer {
override class func transformedValueClass() -> AnyClass {
return NSString.self
@@ -59,9 +59,9 @@ class ISOLanguageCodesValueTranformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
override func transformedValue(_ value: Any?) -> Any? {
if let stringValue = value as? String {
return NSLocale.currentLocale().displayNameForKey(NSLocaleLanguageCode, value: stringValue)
return (Locale.current as NSLocale).displayName(forKey: NSLocale.Key.languageCode, value: stringValue)
}
return nil
}
@@ -71,7 +71,7 @@ class ISOLanguageCodesValueTranformer : NSValueTransformer {
class SelectorsFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let Push = "selectorPush"
static let Popover = "selectorPopover"
static let ActionSheet = "selectorActionSheet"
@@ -90,7 +90,7 @@ class SelectorsFormViewController : XLFormViewController {
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -102,15 +102,15 @@ class SelectorsFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
let barButton = UIBarButtonItem(title: "Disable", style: .plain, target: self, action: #selector(SelectorsFormViewController.disableEnable(_:)))
barButton.possibleTitles = Set(["Disable", "Enable"])
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem)
func disableEnable(_ button : UIBarButtonItem)
{
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
form.isDisabled = !form.isDisabled
button.title = form.isDisabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
@@ -122,7 +122,7 @@ class SelectorsFormViewController : XLFormViewController {
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Selectors")
section = XLFormSectionDescriptor.formSectionWithTitle("Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Selectors")
section.footerTitle = "SelectorsFormViewController.swift"
form.addFormSection(section)
@@ -140,7 +140,7 @@ class SelectorsFormViewController : XLFormViewController {
// Selector Popover
if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad){
if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad){
row = XLFormRowDescriptor(tag: Tags.Popover, rowType:XLFormRowDescriptorTypeSelectorPopover, title:"PopOver")
row.selectorOptions = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6"]
row.value = "Option 2"
@@ -169,7 +169,7 @@ class SelectorsFormViewController : XLFormViewController {
// --------- Fixed Controls
section = XLFormSectionDescriptor.formSectionWithTitle("Fixed Controls")
section = XLFormSectionDescriptor.formSection(withTitle: "Fixed Controls")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Picker, rowType:XLFormRowDescriptorTypePicker)
@@ -178,7 +178,7 @@ class SelectorsFormViewController : XLFormViewController {
section.addFormRow(row)
// --------- Inline Selectors
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Inline Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, rowType:XLFormRowDescriptorTypeSelectorPickerViewInline, title:"Inline Picker View")
@@ -187,7 +187,7 @@ class SelectorsFormViewController : XLFormViewController {
section.addFormRow(row)
// --------- MultipleSelector
section = XLFormSectionDescriptor.formSectionWithTitle("Multiple Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Multiple Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
@@ -206,26 +206,26 @@ class SelectorsFormViewController : XLFormViewController {
// Language multiple selector
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
row.selectorOptions = NSLocale.ISOLanguageCodes()
row.selectorOptions = Locale.isoLanguageCodes
row.selectorTitle = "Languages"
row.valueTransformer = ISOLanguageCodesValueTranformer.self
row.value = NSLocale.preferredLanguages()
row.value = Locale.preferredLanguages
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
if UIDevice.current.userInterfaceIdiom == .pad {
// Language multiple selector popover
row = XLFormRowDescriptor(tag: Tags.MultipleSelectorPopover, rowType:XLFormRowDescriptorTypeMultipleSelectorPopover, title:"Multiple Selector PopOver")
row.selectorOptions = NSLocale.ISOLanguageCodes()
row.selectorOptions = Locale.isoLanguageCodes
row.valueTransformer = ISOLanguageCodesValueTranformer.self
row.value = NSLocale.preferredLanguages()
row.value = Locale.preferredLanguages
section.addFormRow(row)
}
// --------- Dynamic Selectors
section = XLFormSectionDescriptor.formSectionWithTitle("Dynamic Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Dynamic Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.DynamicSelectors, rowType:XLFormRowDescriptorTypeButton, title:"Dynamic Selectors")
@@ -235,7 +235,7 @@ class SelectorsFormViewController : XLFormViewController {
// --------- Custom Selectors
section = XLFormSectionDescriptor.formSectionWithTitle("Custom Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Custom Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomSelectors, rowType:XLFormRowDescriptorTypeButton, title:"Custom Selectors")
@@ -244,7 +244,7 @@ class SelectorsFormViewController : XLFormViewController {
// --------- Selector definition types
section = XLFormSectionDescriptor.formSectionWithTitle("Selectors")
section = XLFormSectionDescriptor.formSection(withTitle: "Selectors")
form.addFormSection(section)
// selector with segue class
@@ -257,7 +257,7 @@ class SelectorsFormViewController : XLFormViewController {
// selector with SegueId
row = XLFormRowDescriptor(tag: Tags.SelectorWithSegueId, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with Segue Idenfifier")
row.action.formSegueIdenfifier = "MapViewControllerSegue";
row.action.formSegueIdentifier = "MapViewControllerSegue";
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
@@ -280,7 +280,7 @@ class SelectorsFormViewController : XLFormViewController {
}
override func storyboardForRow(formRow: XLFormRowDescriptor!) -> UIStoryboard! {
override func storyboard(forRow formRow: XLFormRowDescriptor!) -> UIStoryboard! {
return UIStoryboard(name: "iPhoneStoryboard", bundle:nil)
}
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
@@ -272,11 +273,6 @@
<point key="canvasLocation" x="-159" y="1151"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
<segue reference="wAD-tS-AFZ"/>
</inferredMetricsTieBreakers>
@@ -25,13 +25,13 @@
class UICustomizationFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let Name = "Name"
static let Button = "Button"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
@@ -55,15 +55,15 @@ class UICustomizationFormViewController : XLFormViewController {
// Name
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title:"Name")
// change the background color
row.cellConfigAtConfigure["backgroundColor"] = UIColor.greenColor()
row.cellConfigAtConfigure["backgroundColor"] = UIColor.green
// font
row.cellConfig["textLabel.font"] = UIFont.systemFontOfSize(30)
row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 30)
// background color
row.cellConfig["textField.backgroundColor"] = UIColor.grayColor()
row.cellConfig["textField.backgroundColor"] = UIColor.gray
// font
row.cellConfig["textField.font"] = UIFont.systemFontOfSize(25)
row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 25)
// alignment
row.cellConfig["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.cellConfig["textField.textAlignment"] = NSTextAlignment.right.rawValue
section.addFormRow(row)
@@ -73,23 +73,23 @@ class UICustomizationFormViewController : XLFormViewController {
//Button
row = XLFormRowDescriptor(tag: Tags.Button, rowType: XLFormRowDescriptorTypeButton, title:"Button")
row.cellConfigAtConfigure["backgroundColor"] = UIColor.purpleColor()
row.cellConfig["textLabel.color"] = UIColor.whiteColor()
row.cellConfig["textLabel.font"] = UIFont.systemFontOfSize(40)
row.cellConfigAtConfigure["backgroundColor"] = UIColor.purple
row.cellConfig["textLabel.color"] = UIColor.white
row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 40)
section.addFormRow(row)
self.form = form
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// change cell height of a particular cell
if form.formRowAtIndex(indexPath)?.tag == "Name" {
if form.formRow(atIndex: indexPath)?.tag == "Name" {
return 60.0
}
else if form.formRowAtIndex(indexPath)?.tag == "Button" {
else if form.formRow(atIndex: indexPath)?.tag == "Button" {
return 100.0
}
return super.tableView(tableView, heightForRowAtIndexPath: indexPath)
return super.tableView(tableView, heightForRowAt: indexPath)
}
}
@@ -26,7 +26,7 @@
class ValidationExamplesFormViewController : XLFormViewController {
private struct Tags {
fileprivate struct Tags {
static let ValidationName = "Name"
static let ValidationEmail = "Email"
static let ValidationPassword = "Password"
@@ -34,7 +34,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
initializeForm()
}
@@ -60,8 +60,8 @@ class ValidationExamplesFormViewController : XLFormViewController {
// Name
row = XLFormRowDescriptor(tag: Tags.ValidationName, rowType: XLFormRowDescriptorTypeText, title:"Name")
row.cellConfigAtConfigure["textField.placeholder"] = "Required..."
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.required = true
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.right.rawValue
row.isRequired = true
row.value = "Martin"
section.addFormRow(row)
@@ -71,10 +71,10 @@ class ValidationExamplesFormViewController : XLFormViewController {
// Email
row = XLFormRowDescriptor(tag: Tags.ValidationEmail, rowType: XLFormRowDescriptorTypeText, title:"Email")
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.required = false
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.right.rawValue
row.isRequired = false
row.value = "not valid email"
row.addValidator(XLFormValidator.emailValidator())
row.addValidator(XLFormValidator.email())
section.addFormRow(row)
@@ -86,8 +86,8 @@ class ValidationExamplesFormViewController : XLFormViewController {
// Password
row = XLFormRowDescriptor(tag: Tags.ValidationPassword, rowType: XLFormRowDescriptorTypePassword, title:"Password")
row.cellConfigAtConfigure["textField.placeholder"] = "Required..."
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.required = true
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.right.rawValue
row.isRequired = true
row.addValidator(XLFormRegexValidator(msg: "At least 6, max 32 characters", andRegexString: "^(?=.*\\d)(?=.*[A-Za-z]).{6,32}$"))
section.addFormRow(row)
@@ -100,8 +100,8 @@ class ValidationExamplesFormViewController : XLFormViewController {
// Integer
row = XLFormRowDescriptor(tag: Tags.ValidationInteger, rowType:XLFormRowDescriptorTypeInteger, title:"Integer")
row.cellConfigAtConfigure["textField.placeholder"] = "Required..."
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.required = true
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.right.rawValue
row.isRequired = true
row.addValidator(XLFormRegexValidator(msg: "greater than 50 and less than 100", andRegexString: "^([5-9][0-9]|100)$"))
section.addFormRow(row)
@@ -111,30 +111,30 @@ class ValidationExamplesFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem?.target = self
navigationItem.rightBarButtonItem?.action = "validateForm:"
navigationItem.rightBarButtonItem?.action = #selector(ValidationExamplesFormViewController.validateForm(_:))
}
//MARK: Actions
func validateForm(buttonItem: UIBarButtonItem) {
func validateForm(_ buttonItem: UIBarButtonItem) {
let array = formValidationErrors()
for errorItem in array {
for errorItem in array! {
let error = errorItem as! NSError
let validationStatus : XLFormValidationStatus = error.userInfo[XLValidationStatusErrorKey] as! XLFormValidationStatus
if validationStatus.rowDescriptor!.tag == Tags.ValidationName {
if let rowDescriptor = validationStatus.rowDescriptor, let indexPath = form.indexPathOfFormRow(rowDescriptor), let cell = tableView.cellForRowAtIndexPath(indexPath) {
cell.backgroundColor = .orangeColor()
UIView.animateWithDuration(0.3, animations: { () -> Void in
cell.backgroundColor = .whiteColor()
if let rowDescriptor = validationStatus.rowDescriptor, let indexPath = form.indexPath(ofFormRow: rowDescriptor), let cell = tableView.cellForRow(at: indexPath) {
cell.backgroundColor = .orange
UIView.animate(withDuration: 0.3, animations: { () -> Void in
cell.backgroundColor = .white
})
}
}
else if validationStatus.rowDescriptor!.tag == Tags.ValidationEmail ||
validationStatus.rowDescriptor!.tag == Tags.ValidationPassword ||
validationStatus.rowDescriptor!.tag == Tags.ValidationInteger {
if let rowDescriptor = validationStatus.rowDescriptor, let indexPath = form.indexPathOfFormRow(rowDescriptor), let cell = tableView.cellForRowAtIndexPath(indexPath) {
if let rowDescriptor = validationStatus.rowDescriptor, let indexPath = form.indexPath(ofFormRow: rowDescriptor), let cell = tableView.cellForRow(at: indexPath) {
self.animateCell(cell)
}
}
@@ -144,14 +144,14 @@ class ValidationExamplesFormViewController : XLFormViewController {
//MARK: - Helperph
func animateCell(cell: UITableViewCell) {
func animateCell(_ cell: UITableViewCell) {
let animation = CAKeyframeAnimation()
animation.keyPath = "position.x"
animation.values = [0, 20, -20, 10, 0]
animation.keyTimes = [0, (1 / 6.0), (3 / 6.0), (5 / 6.0), 1]
animation.keyTimes = [0, NSNumber(value: 1 / 6.0), NSNumber(value: 3 / 6.0), NSNumber(value: 5 / 6.0), 1]
animation.duration = 0.3
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
animation.additive = true
cell.layer.addAnimation(animation, forKey: "shake")
animation.isAdditive = true
cell.layer.add(animation, forKey: "shake")
}
}
Executable → Regular
+204 -168
View File
@@ -4,9 +4,9 @@ XLForm
By [XMARTLABS](http://xmartlabs.com).
[![Build Status](https://travis-ci.org/xmartlabs/XLForm.svg?branch=master)](https://travis-ci.org/xmartlabs/XLForm)
[![license](https://img.shields.io/badge/pod-3.0.2-blue.svg)](https://github.com/xmartlabs/XLForm/releases)
<a href="https://cocoapods.org/pods/XLForm"><img src="https://img.shields.io/cocoapods/v/XLForm.svg" alt="CocoaPods compatible" /></a>
**If you are looking for Swift 2 native implementation we have recently created [Eureka], a complete re-design of XLForm in Swift 2.** *Do not panic, We will continue maintaining and improving XLForm, obj-c rocks!!*
**If you are working in Swift then you should have a look at [Eureka], a complete re-design of XLForm in Swift.** *Do not panic, we will continue maintaining and improving XLForm, obj-c rocks!!*
Purpose
--------------
@@ -15,7 +15,7 @@ XLForm is the most flexible and powerful iOS library to create dynamic table-vie
XLForm provides a very powerful DSL (Domain Specific Language) used to create a form. It keeps track of this specification on runtime, updating the UI on the fly.
#####Let's see the iOS Calendar Event Form created using XLForm
##### Let's see the iOS Calendar Event Form created using XLForm
![Screenshot of native Calendar Event Example](Examples/Objective-C/Examples/RealExamples/XLForm.gif)
@@ -38,8 +38,75 @@ What XLForm does
How to create a form
-----------------------------
## How to create a form
#### Create an instance of XLFormViewController
##### Swift
```swift
class CalendarEventFormViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
func initializeForm() {
// Implementation details covered in the next section.
}
}
```
##### Objective-C
```objc
#import "XLFormViewController.h"
@interface CalendarEventFormViewController: XLFormViewController
@end
```
```objc
@interface ExamplesFormViewController ()
@end
@implementation ExamplesFormViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
[self initializeForm];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self){
[self initializeForm];
}
return self;
}
- (void)initializeForm {
// Implementation details covered in the next section.
}
@end
```
##### Implementing the initializeForm method
To create a form we should declare it through a `XLFormDescriptor` instance and assign it to a `XLFormViewController` instance. As we said XLForm works based on a DSL that hides complex and boilerplate stuff without losing the power and flexibility of hand-made forms.
@@ -51,50 +118,58 @@ To define a form we use 3 classes:
A form definition is a `XLFormDescriptor` instance that contains one or more sections (`XLFormSectionDescriptor` instances) and each section contains several rows (`XLFormRowDescriptor` instance). As you may have noticed the DSL structure is analog to the structure of a `UITableView` (Table -->> Sections -- >> Rows). The resulting table-view form's structure (sections and rows order) mirrors the definition's structure.
#####Let's see part of the iOS Calendar Event Form definition.
##### Let's see an example implementation of initializeForm to define the iOS Calendar Event Form
```objc
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
- (void)initializeForm {
XLFormDescriptor * form;
XLFormSectionDescriptor * section;
XLFormRowDescriptor * row;
form = [XLFormDescriptor formDescriptorWithTitle:@"Add Event"];
form = [XLFormDescriptor formDescriptorWithTitle:@"Add Event"];
// First section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// First section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Title
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Title
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Title" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Location
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"location" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Location" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Location
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"location" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@"Location" forKey:@"textField.placeholder"];
[section addFormRow:row];
// Second Section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// Second Section
section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
// All-day
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"all-day" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"All-day"];
[section addFormRow:row];
// All-day
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"all-day" rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"All-day"];
[section addFormRow:row];
// Starts
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"starts" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Starts"];
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*24];
[section addFormRow:row];
// Starts
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"starts" rowType:XLFormRowDescriptorTypeDateTimeInline title:@"Starts"];
row.value = [NSDate dateWithTimeIntervalSinceNow:60*60*24];
[section addFormRow:row];
self.form = form;
}
```
XLForm will load the table-view form from the previously explained definition. The most interesting part is that it will update the table-view form based on the form definition modifications.
That means that we are able to make changes on the table-view form adding or removing section definitions or row definitions to the form definition on runtime and you will never need to care again about `NSIndexPath`, `UITableViewDelegate`, `UITableViewDataSource` or other complexities.
**To see more complex form definitions take a look at the example application in the Examples folder of this repository. You can also run the examples on your own device if you wish.** XLForm **has no** dependencies over other pods, anyway the examples project makes use of some cocoapods to show advanced XLForm features.
## Using XLForm with Storyboards
* Perform the steps from **How to create a form**
* In Interface Builder (IB), drag-and-drop a **UIViewController** onto the Storyboard
* Associate your custom form class to the **UIViewController** using the **Identity Inspector**
How to run XLForm examples
---------------------------------
@@ -107,7 +182,7 @@ How to run XLForm examples
Rows
---------------------
####Input Rows
#### Input Rows
![Screenshot of Input Examples](Examples/Objective-C/Examples/Inputs/XLForm-Inputs.gif)
@@ -178,7 +253,7 @@ Will be represented by a `UITextView` with `UITextAutocorrectionTypeDefault`, `U
####Selector Rows
#### Selector Rows
Selector rows allow us to select a value or values from a list. XLForm supports 8 types of selectors out of the box:
@@ -245,7 +320,7 @@ This is the protocol declaration:
```
####Date & Time Rows
#### Date & Time Rows
XLForms supports 3 types of dates: `Date`, `DateTime` , `Time` and `Countdown Timer` and it's able to present the `UIDatePicker` control in 2 different ways, inline and non-inline.
@@ -352,7 +427,7 @@ section.addFormRow(row)
self.form = form;
```
####Boolean Rows
#### Boolean Rows
XLForms supports 2 types of boolean controls:
@@ -370,9 +445,9 @@ static NSString *const XLFormRowDescriptorTypeBooleanSwitch = @"booleanSwitch";
We can also simulate other types of Boolean rows using any of the Selector Row Types introduced in the [Selector Rows section](#selector-rows).
####Other Rows
#### Other Rows
#####Stepper
##### Stepper
XLForms supports counting using UIStepper control:
@@ -394,7 +469,7 @@ You can set the stepper paramaters easily:
[row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
```
#####Slider
##### Slider
XLForms supports counting using UISlider control:
@@ -415,11 +490,11 @@ You can adjust the slider for your own interests very easily:
Set `steps` to `@(0)` to disable the steps functionality.
#####Info
##### Info
Sometimes our apps needs to show data that are not editable. XLForm provides us with `XLFormRowDescriptorTypeInfo` row type to display not editable info. An example of usage would be showing the app version in the settings part of an app.
#####Button
##### Button
Apart from data entry rows, not editable rows and selectors, XLForm has a button row `XLFormRowDescriptorTypeButton` that allows us to do any action when selected. It can be configured using a block (clousure), a selector, a segue identifier, segue class or specifing a view controller to be presented. ViewController specification could be done by setting up the view controller class, the view controller storyboard Id or a nib name. Nib name must match view controller class name.
@@ -615,6 +690,8 @@ XLForm sets up `rowDescriptor` property using the `XLFormRowDescriptor` instance
The developer is responsible for update its views with the `rowDescriptor` value as well as set the selected value to `rowDescriptor` from within the custom selector view controller.
> Note: the properties `viewControllerClass`, `viewControllerNibName` or `viewControllerStoryboardId` are mutually exclusive and are used by `XLFormButtonCell` and `XLFormSelectorCell`. If you create a custom cell then you are responsible for using them.
#### Another example
@@ -647,6 +724,8 @@ Usually you may want to change the form when some value change or some row or se
In order to stay in sync with the form descriptor modifications your `XLFormViewController` subclass should override the `XLFormDescriptorDelegate` methods of 'XLFormViewController'.
> Note: It is important to always call the `[super ...]` method when overriding this delegate's methods.
```objc
@protocol XLFormDescriptorDelegate <NSObject>
@@ -657,6 +736,10 @@ In order to stay in sync with the form descriptor modifications your `XLFormView
-(void)formRowHasBeenAdded:(XLFormRowDescriptor *)formRow atIndexPath:(NSIndexPath *)indexPath;
-(void)formRowHasBeenRemoved:(XLFormRowDescriptor *)formRow atIndexPath:(NSIndexPath *)indexPath;
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue;
-(void)formRowDescriptorPredicateHasChanged:(XLFormRowDescriptor *)formRow
oldValue:(id)oldValue
newValue:(id)newValue
predicateType:(XLPredicateType)predicateType;
@end
```
@@ -684,7 +767,7 @@ For instance if we want to show or hide a row depending on the value of another
Make a row or section invisible depending on other rows values
--------------------------------
###Summary
### Summary
XLForm allows you to define dependencies between rows so that if the value of one row is changed, the behaviour of another one changes automatically. For example, you might have a form where you question the user if he/she has pets. If the answer is 'yes' you might want to ask how their names are.
So you can make a row invisible and visible again based on the values of other rows. The same happens with sections.
@@ -694,7 +777,7 @@ Take a look at the following example:
Of course, you could also do this manually by observing the value of some rows and deleting and adding rows accordingly, but that would be a lot of work which is already done.
###How it works
### How it works
To make the appearance and disappearance of rows and sections automatic, there is a property in each descriptor:
@@ -783,6 +866,7 @@ You may want to set up another properties of the `UITableViewCell`. To set up an
You just have to add the properties to `cellConfig` or `cellConfigAtConfigure` dictionary property of `XLFormRowDescriptor`.
The main difference between `cellConfig` and `cellConfigAtConfigure` is the time when the property is set up. `cellConfig` properties are set up each time a cell is about to be displayed. `cellConfigAtConfigure`, on the other hand, set up the property just after the init method of the cell is called and only one time.
Since version 3.3.0 you can also use `cellConfigForSelector` to configure how the cells of the `XLFormOptionsViewController` look like when it is shown for a selector row.
For instance if you want to set up the placeholder you can do the following:
@@ -798,7 +882,7 @@ Let's see how to change the color of the cell label:
```objc
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"title" rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:[UIColor red] forKey:@"textLabel.textColor"];
[row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
[section addFormRow:row];
```
@@ -813,6 +897,25 @@ section.addFormRow(row)
FAQ
-------
#### How to customize the header and/or footer of a section
For this you should use the UITableViewDelegate methods in your XLFormViewController.
This means you should implement one or both of these:
```objc
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
```
Also you might want to implement the following methods to specify the height for these views:
```objc
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
```
#### How to assign the first responder on form appearance
Assign the first responder when the form is shown is as simple as setting the property `assignFirstResponderOnShow` to `YES`. By default the value of the property is `NO`.
@@ -901,6 +1004,8 @@ You can change the length of a UITextField using the `cellConfigAtConfigure` dic
row.cellConfigAtConfigure.setObject(0.7, forKey:XLFormTextFieldLengthPercentage)
```
**Note:**The same can be achieved for the UITextView when using `XLFormRowDescriptorTypeTextView`; just set your percentage for the key `XLFormTextViewLengthPercentage`.
#### How to change a UITableViewCell font
You can change the font or any other table view cell property using the `cellConfig` dictionary property. XLForm will set up `cellConfig` dictionary values when the table view cell is about to be displayed.
@@ -922,7 +1027,7 @@ row.cellConfig.setObject(UIFont(name: "AppleSDGothicNeo-Regular", size: 17)!, fo
For further details, please take a look at [UICustomizationFormViewController.m](/Examples/Objective-C/Examples/UICustomization/UICustomizationFormViewController.m) example.
####How to set min/max for date cells?
#### How to set min/max for date cells?
Each XLFormDateCell has a `minimumDate` and a `maximumDate` property. To set a datetime row to be a value in the next three days you would do as follows:
@@ -991,10 +1096,34 @@ This is how you can set them:
[row.cellConfigAtConfigure setObject:@(UIReturnKeyGo) forKey:@"nextReturnKeyType"];
```
#### How to change the height of one cell
If you want to change the height for all cells of one class you should subclass that cell and override the class method `formDescriptorCellHeightForRowDescriptor`.
If you want to change the height of one individual cell then you can set that height to the `height` property of XLFormRowDescripto like this:
```
XLFormRowDescriptor* row = ...
row.height = 55;
```
#### How to change the appearance of the cells of a selector view controller (XLFormOptionsViewController)
To change the appearance of the cells of a XLFormOptionsViewController you can use the `cellConfigForSelector` property on the row descriptor.
Example:
```
[row.cellConfigForSelector setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
```
#### How to limit the characters of a XLFormTextFieldCell or a XLFormTextViewCell
You can make this happen using the `textFieldMaxNumberOfCharacters` and the `textViewMaxNumberOfCharacters` respectively.
```
[row.cellConfigAtConfigure setObject:@(20) forKey:@"textViewMaxNumberOfCharacters"];
```
Installation
--------------------------
## Cocoapods
## CocoaPods
1. Add the following line in the project's Podfile file:
`pod 'XLForm', '~> 3.0'`.
@@ -1002,15 +1131,7 @@ Installation
XLForm **has no** dependencies over other pods.
## Carthage
In your `Cartfile` add:
```
github "xmartlabs/XLForm" ~> 3.0
```
### How to use master branch
#### How to use master branch
Often master branch contains most recent features and latest fixes. On the other hand this features was not fully tested and changes on master may occur at any time. For the previous reasons I stongly recommend to fork the repository and manage the updates from master on your own making the proper pull on demand.
@@ -1021,7 +1142,7 @@ To use xmartlabs master branch.....
You can replace the repository URL for your forked version url if you wish.
### How to use XLForm in Swift files
#### How to use XLForm in Swift files
If you have installed XLForm with cocoapods and have set `use_frameworks!` in your Podfile, you can add `import XLForm` to any Swift file.
@@ -1029,6 +1150,31 @@ If you are using cocoapods but have not set `use_frameworks!` in your Podfile, a
For further details on how to create and configure the bridging header file visit [*Importing Objective-C into Swift*](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html "Importing Objective-C into Swift").
## Carthage
In your `Cartfile` add:
```
github "xmartlabs/XLForm" ~> 3.0
```
## Using git submodules
* Clone XLForm as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command from your project root git folder.
```bash
$ git submodule add https://github.com/xmartlabs/XLForm.git
```
* Open XLForm folder that was created by the previous git submodule command and drag the XLForm.xcodeproj into the Project Navigator of your application's Xcode project.
* Select the XLForm.xcodeproj in the Project Navigator and verify the deployment target matches with your application deployment target.
* Select your project in the Xcode Navigation and then select your application target from the sidebar. Next select the "General" tab and click on the + button under the "Embedded Binaries" section.
* Select `XLForm.framework` and we are done!
Requirements
-----------------------------
@@ -1040,117 +1186,7 @@ Requirements
Release Notes
--------------
Version 3.1.0
* Added Carthage support
* Added NSCoding protocol
* Allowed HTTP connections
* Several bugfixes and improvements.
Version 3.0.2
* Fix issue when inline pickers expand beyond table.
Version 3.0.1
* Improvements and bug fixes.
* Ability to left, right align textfields. Ability to set up a minimum textField width.
* If form is being shown, assigning a new form automatically reload the tableview.
* Update objective-c and swift example projects.
* Swift compatibility fixes.
* Long email validation added.
* Fixed row copy issue, now valueTransformer value is copied.
* Fixed step counter row layout issues.
* Fixed issue "Last form field hides beneath enabled navigation controller's toolbar".
* Fixed issue "Navigating between cells using bottom navigation buttons causes table cell dividers to disappear".
* Use UIAlertController instead UIActionSheet/UIAlertView if possible.
* Hidden and disabled rows resign first responder before changing state.
* onChangeBlock added to rowDescriptor.
* use tintColor as default button row color.
* By default accessoryView is no longer shown for inline rows.
* Fix NSBundle issues to use XLForm as dynamic framework.
Version 3.0.0
* `hidden`, `disable` properties added to `XLFormRowDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide, disable de row.
* `hidden` property added to `XLFormSectionDescriptor`. `@YES` `@NO` or a `NSPredicate` can be used to hide the section.
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
* Added `XLFormRowDescriptorTypeCountDownTimerInline` and `XLFormRowDescriptorTypeCountDownTimer` row type with an example.
* Deleted `dateFormatter` property and added support to use the `NSValueTransformer` to convert the selected object to a NSString in the XLFormDateCell class.
Version 2.2.0
* Fixed "(null)" caption when `XLFormRowDescriptorTypeSelectorLeftRight` row required error message is shown.
* Refresh the cell content instead of recreating one, when the form get back from a selection.
* Added XLFormRowDescriptor to validations error to easily show an error mask.
* Use row tag in validation error message if row does not have a title. It is also possible to set up a custom message if needed
* Added a convenience method to add a XLFormRowDescriptor instance before another one.
* Allow nil values in cellConfig and cellConfigAtConfigure.
* Fix constraints for textFieldCell when it is configured to be right aligned.
* Add asterisk to required segmentedCells if needed.
* Fail validation for empty strings and NSNull on required rows.
* Segue support added to buttons and selectors.
* Ability to configure a storyboardId or a viewController nibName to by used by button and selector rows as presented view controller.
* Fix scrolling to top when status bar is tapped.
* Fix wrong type of XLFormRowDescriptorTypeDecimal row. Now it's converted to NSNumber.
* Fix issue: XLFormRegexValidator only checks regex validation for NSStrings, not working for number.
* Callconfigure method from awakeFromNib on XLFormBaseCell.
* Assign form.delegate from inside setForm: method.
* Added custom cell, validation, reordering, can insert, can delete examples.
* Added support for inputAccessoryView. Default input accessory view allows to navigate among rows. Fully optionally and customizable.
* Added suport for row navigation. Fully optionally and customizable.
* beginEditing: endEditing: methods added. These method are called each time a row gains / loses firstResponder. They bring the ability to do UI changes.
* Read Only mode added. `disable` property added to XLFormDescriptor class.
* Rename `label` XLFormTextViewCell property as `textLabel`.
* fix position of multivalued section accessory view.
* Can delete, can delete, can reorder section mode added. it's possible to enable some of them, don't need to enable all modes.
Version 2.1.0
* Change `XLFormRowDescriptorTypeText`, `XLFormRowDescriptorTypeName` and `XLFormRowDescriptorTypeTextView` keyboard type to `UIKeyboardTypeDefault`.
* Added `XLFormRowDescriptorTypeInfo` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPopover` row type and example.
* CI added. Created Test project into Tests folder and set up Travis.
* Documented how to customize UI. Added an example.
* Now XLFormViewController extends from UIViewController instead of UITableViewController.
* Added tableView property as a XLFormViewController IBOutlet.
* Added support for storyboard reuse identifier and nib file.
* Button selection can be handled using a selector or block.
* Added addAsteriskToRequiredRowsTitle property to XLFormDescriptor. NO is used as value by default.
* Image cell has been removed because it depends on AFNetworking and now needs to be implemented as a custom cell. You can find the image custom cell in Examples/Others/CustomCells.
Version 2.0.0 (cocoaPod)
* Added `XLFormRowDescriptorTypeMultipleSelector` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPickerView` row type and example.
* Added `XLFormRowDescriptorTypeSelectorPickerViewInline` row type and example.
* Added generic way to create inline selector rows.
* Ability to customize row animations.
* `(NSDictionary *)formValues;` XLFormViewController method added in order to get raw form data.
* Added `XLFormRowDescriptorTypeSelectorSegmentedControl` row type and example.
* AFNetworking dependency removed.
* Added `XLFormRowDescriptorTypeStepCounter` row type and related example.
Version 1.0.1 (cocoaPod)
* Added storyboard example.
* Added button `XLFormRowDescriptorTypeButton` example.
* Documented how to add a custom row.
* Fixed issues: [#2](https://github.com/xmartlabs/XLForm/issues/2 "#2"), [#3](https://github.com/xmartlabs/XLForm/issues/3 "#3"), [#27](https://github.com/xmartlabs/XLForm/issues/27 "#27"), [#38](https://github.com/xmartlabs/XLForm/issues/38 "#38").
* Fixed crash caused by inline date rows. [#6](https://github.com/xmartlabs/XLForm/issues/6 "#6")
* Fixed ipad issue *invalid cell layout*. [#10](https://github.com/xmartlabs/XLForm/issues/10 "#10")
* New convenience methods to insert sections dinamically. [#13](https://github.com/xmartlabs/XLForm/pull/13 "#13")
* Change default label style to `UIFontTextStyleBody`. [#18](https://github.com/xmartlabs/XLForm/issues/18 "#18")
* Added step counter row, `XLFormRowDescriptorTypeStepCounter`.
* Added `initWithCoder` initializer to `XLFormViewController`. [#32](https://github.com/xmartlabs/XLForm/issues/32 "#32").
* Added a convenience method to deselect a `XLFormRowDescriptor`. `-(void)deselectFormRow:(XLFormRowDescriptor *)row;`. [#33](https://github.com/xmartlabs/XLForm/issues/33 "#33").
Version 1.0.0 (cocoaPod)
* Initial release
Have a look at the [CHANGELOG](https://github.com/xmartlabs/XLForm/blob/master/CHANGELOG.md)
Author
-----------------
+2 -2
View File
@@ -3,7 +3,7 @@ include FileUtils::Verbose
namespace :test do
desc "Run the XLForm Tests"
task :ios do
run_tests('XLForm Tests', 'iphonesimulator9.2')
run_tests('XLForm Tests', 'iphonesimulator10.2')
tests_failed unless $?.success?
end
end
@@ -17,7 +17,7 @@ task :default => 'test'
private
def run_tests(scheme, sdk)
sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'name=iPhone 6' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
sh("xcodebuild -workspace 'Tests/XLForm Tests.xcworkspace' -scheme '#{scheme}' -sdk '#{sdk}' -destination 'OS=10.1,name=iPhone 7' -configuration Release clean test | xcpretty -c ; exit ${PIPESTATUS[0]}") rescue nil
end
def tests_failed
+5 -3
View File
@@ -1,7 +1,9 @@
source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'XLForm Tests'
project 'XLForm Tests'
inhibit_all_warnings!
platform :ios, '7.0'
pod 'Expecta', '~> 0.3.0'
pod 'XLForm', :path => '../'
target 'XLForm Tests' do
pod 'Expecta', '~> 0.3.0'
pod 'XLForm', :path => '../'
end
+44 -12
View File
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
03885A911D7DD3BD00CC183A /* XLTestTextFieldProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 03885A901D7DD3BD00CC183A /* XLTestTextFieldProperties.m */; };
17538872B9BB29167787CF50 /* libPods-XLForm Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */; };
28657A3E1990879200CE8180 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A3D1990879200CE8180 /* XCTest.framework */; };
28657A401990879200CE8180 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A3F1990879200CE8180 /* Foundation.framework */; };
28657A421990879200CE8180 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28657A411990879200CE8180 /* UIKit.framework */; };
@@ -15,11 +17,12 @@
28657A54199154EE00CE8180 /* XLFormValidatorsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 28657A53199154EE00CE8180 /* XLFormValidatorsTests.m */; };
3C5B9B7A1AC0BA33000AF1BA /* XLFormExampleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C5B9B791AC0BA33000AF1BA /* XLFormExampleTest.m */; };
3C9817861AC30616003F6ABD /* UITextField+Test.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9817851AC30616003F6ABD /* UITextField+Test.m */; };
803CF19E12514D00A5080A99 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CEC7E8601D7342BFAF4C4060 /* libPods.a */; };
6233D65F1D7DF022000E7716 /* XLTestTextViewProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 6233D65E1D7DF022000E7716 /* XLTestTextViewProperties.m */; };
BFD111841AD8323900943D23 /* XLTestHideAndShow.m in Sources */ = {isa = PBXBuildFile; fileRef = BFD111831AD8323900943D23 /* XLTestHideAndShow.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
03885A901D7DD3BD00CC183A /* XLTestTextFieldProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestTextFieldProperties.m; path = Test/XLTestTextFieldProperties.m; sourceTree = "<group>"; };
28657A3A1990879200CE8180 /* XLForm Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "XLForm Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
28657A3D1990879200CE8180 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
28657A3F1990879200CE8180 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
@@ -30,13 +33,17 @@
28657A5019914F9700CE8180 /* XLTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLTestCase.h; path = Test/XLTestCase.h; sourceTree = "<group>"; };
28657A5119914F9700CE8180 /* XLTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestCase.m; path = Test/XLTestCase.m; sourceTree = "<group>"; };
28657A53199154EE00CE8180 /* XLFormValidatorsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormValidatorsTests.m; path = Test/XLFormValidatorsTests.m; sourceTree = "<group>"; };
35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.debug.xcconfig"; sourceTree = "<group>"; };
3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-XLForm Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests.release.xcconfig"; sourceTree = "<group>"; };
3C5B9B791AC0BA33000AF1BA /* XLFormExampleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormExampleTest.m; path = Test/XLFormExampleTest.m; sourceTree = "<group>"; };
3C9817841AC30616003F6ABD /* UITextField+Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UITextField+Test.h"; path = "Helpers/UITextField+Test.h"; sourceTree = "<group>"; };
3C9817851AC30616003F6ABD /* UITextField+Test.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UITextField+Test.m"; path = "Helpers/UITextField+Test.m"; sourceTree = "<group>"; };
6233D65E1D7DF022000E7716 /* XLTestTextViewProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestTextViewProperties.m; path = Test/XLTestTextViewProperties.m; sourceTree = "<group>"; };
8ADC094C94CA7ABBB8134573 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
BFD111831AD8323900943D23 /* XLTestHideAndShow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLTestHideAndShow.m; path = Test/XLTestHideAndShow.m; sourceTree = "<group>"; };
C6B20EA1A9D9591335BEE81F /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
CEC7E8601D7342BFAF4C4060 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-XLForm Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -47,7 +54,7 @@
28657A3E1990879200CE8180 /* XCTest.framework in Frameworks */,
28657A421990879200CE8180 /* UIKit.framework in Frameworks */,
28657A401990879200CE8180 /* Foundation.framework in Frameworks */,
803CF19E12514D00A5080A99 /* libPods.a in Frameworks */,
17538872B9BB29167787CF50 /* libPods-XLForm Tests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -79,6 +86,7 @@
28657A3F1990879200CE8180 /* Foundation.framework */,
28657A411990879200CE8180 /* UIKit.framework */,
CEC7E8601D7342BFAF4C4060 /* libPods.a */,
E68572C5C8328F0F177BBCA1 /* libPods-XLForm Tests.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -111,6 +119,8 @@
28657A5019914F9700CE8180 /* XLTestCase.h */,
28657A5119914F9700CE8180 /* XLTestCase.m */,
28657A53199154EE00CE8180 /* XLFormValidatorsTests.m */,
03885A901D7DD3BD00CC183A /* XLTestTextFieldProperties.m */,
6233D65E1D7DF022000E7716 /* XLTestTextViewProperties.m */,
);
name = Tests;
sourceTree = "<group>";
@@ -129,6 +139,8 @@
children = (
C6B20EA1A9D9591335BEE81F /* Pods.debug.xcconfig */,
8ADC094C94CA7ABBB8134573 /* Pods.release.xcconfig */,
35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */,
3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
@@ -140,11 +152,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 28657A4C1990879200CE8180 /* Build configuration list for PBXNativeTarget "XLForm Tests" */;
buildPhases = (
6B058765CC1143829C6943B9 /* Check Pods Manifest.lock */,
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */,
28657A361990879200CE8180 /* Sources */,
28657A371990879200CE8180 /* Frameworks */,
28657A381990879200CE8180 /* Resources */,
3E5FCF05A57F40C6AF367F6D /* Copy Pods Resources */,
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */,
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -192,34 +205,49 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3E5FCF05A57F40C6AF367F6D /* Copy Pods Resources */ = {
3E5FCF05A57F40C6AF367F6D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6B058765CC1143829C6943B9 /* Check Pods Manifest.lock */ = {
6A2C507B76209618EDA57426 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-XLForm Tests/Pods-XLForm Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
6B058765CC1143829C6943B9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@@ -231,7 +259,9 @@
files = (
28657A54199154EE00CE8180 /* XLFormValidatorsTests.m in Sources */,
28657A5219914F9700CE8180 /* XLTestCase.m in Sources */,
03885A911D7DD3BD00CC183A /* XLTestTextFieldProperties.m in Sources */,
BFD111841AD8323900943D23 /* XLTestHideAndShow.m in Sources */,
6233D65F1D7DF022000E7716 /* XLTestTextViewProperties.m in Sources */,
3C5B9B7A1AC0BA33000AF1BA /* XLFormExampleTest.m in Sources */,
3C9817861AC30616003F6ABD /* UITextField+Test.m in Sources */,
);
@@ -266,7 +296,7 @@
};
28657A4D1990879200CE8180 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = C6B20EA1A9D9591335BEE81F /* Pods.debug.xcconfig */;
baseConfigurationReference = 35038A584FCFD0693D23F189 /* Pods-XLForm Tests.debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -305,6 +335,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
LIBRARY_SEARCH_PATHS = "$(inherited)";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -314,7 +345,7 @@
};
28657A4E1990879200CE8180 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8ADC094C94CA7ABBB8134573 /* Pods.release.xcconfig */;
baseConfigurationReference = 3BE0FA85B15844909EF36AB4 /* Pods-XLForm Tests.release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -347,6 +378,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "XLForm Tests/XLForm Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@@ -0,0 +1,66 @@
//
// XLTestTextFieldProperties.m
// XLForm Tests
//
// Created by Claus on 9/5/16.
//
//
#import "XLTestCase.h"
#import <XLForm/XLFormTextFieldCell.h>
#import <UIKit/UIKit.h>
@interface XLTestTextFieldProperties : XLTestCase
@end
@implementation XLTestTextFieldProperties
- (void)testPropertiesGetSet
{
// Get the tableView
UITableView * tableView = self.formController.tableView;
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
// Check if the cell contains the correct properties
expect(cell).to.beKindOf([XLFormTextFieldCell class]);
XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell;
expect(textFieldCell.textFieldLengthPercentage).to.equal(0.3);
expect(textFieldCell.textFieldMaxNumberOfCharacters).to.equal(10);
}
- (void)testMaxNumbersOfCharacters
{
// Get the tableView
UITableView * tableView = self.formController.tableView;
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
expect(cell).to.beKindOf([XLFormTextFieldCell class]);
XLFormTextFieldCell * textFieldCell = (XLFormTextFieldCell *)cell;
// Check if range check works
expect(cell).to.conformTo(@protocol(UITextFieldDelegate));
id<UITextFieldDelegate> textFieldDelegate = (id<UITextFieldDelegate>)cell;
NSRange range = NSMakeRange(0, 0);
expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"123"]).to.beTruthy();
expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"1234567890"]).to.beTruthy();
expect([textFieldDelegate textField:textFieldCell.textField shouldChangeCharactersInRange:range replacementString:@"12345678901"]).to.beFalsy();
}
#pragma mark - Build Form
-(void)buildForm
{
XLFormDescriptor * form = [XLFormDescriptor formDescriptor];
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeText];
[row.cellConfigAtConfigure setObject:@(0.3) forKey:XLFormTextFieldLengthPercentage];
[row.cellConfigAtConfigure setObject:@(10) forKey:XLFormTextFieldMaxNumberOfCharacters];
[section addFormRow:row];
self.formController.form = form;
}
@end
@@ -0,0 +1,66 @@
//
// XLTestTextViewProperties.m
// XLForm Tests
//
// Created by Claus on 9/5/16.
//
//
#import "XLTestCase.h"
#import <XLForm/XLFormTextViewCell.h>
#import <UIKit/UIKit.h>
@interface XLTestTextViewProperties : XLTestCase
@end
@implementation XLTestTextViewProperties
- (void)testPropertiesGetSet
{
// Get the tableView
UITableView * tableView = self.formController.tableView;
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
// Check if the cell contains the correct properties
expect(cell).to.beKindOf([XLFormTextViewCell class]);
XLFormTextViewCell * textViewCell = (XLFormTextViewCell *)cell;
expect(textViewCell.textViewLengthPercentage).to.equal(0.3);
expect(textViewCell.textViewMaxNumberOfCharacters).to.equal(10);
}
- (void)testMaxNumbersOfCharacters
{
// Get the tableView
UITableView * tableView = self.formController.tableView;
UITableViewCell * cell = [self.formController tableView:tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
expect(cell).to.beKindOf([XLFormTextViewCell class]);
XLFormTextViewCell * textViewCell = (XLFormTextViewCell *)cell;
// Check if range check works
expect(cell).to.conformTo(@protocol(UITextViewDelegate));
id<UITextViewDelegate> textFieldDelegate = (id<UITextViewDelegate>)cell;
NSRange range = NSMakeRange(0, 0);
expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"123"]).to.beTruthy();
expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"1234567890"]).to.beTruthy();
expect([textFieldDelegate textView:textViewCell.textView shouldChangeTextInRange:range replacementText:@"12345678901"]).to.beFalsy();
}
#pragma mark - Build Form
-(void)buildForm
{
XLFormDescriptor * form = [XLFormDescriptor formDescriptor];
XLFormSectionDescriptor * section = [XLFormSectionDescriptor formSection];
[form addFormSection:section];
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:XLFormRowDescriptorTypeTextView];
[row.cellConfigAtConfigure setObject:@(0.3) forKey:XLFormTextViewLengthPercentage];
[row.cellConfigAtConfigure setObject:@(10) forKey:XLFormTextViewMaxNumberOfCharacters];
[section addFormRow:row];
self.formController.form = form;
}
@end
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'XLForm'
s.version = '3.1.0'
s.version = '3.3.0'
s.license = { :type => 'MIT' }
s.summary = 'XLForm is the most flexible and powerful iOS library to create dynamic table-view forms.'
s.description = <<-DESC
+11 -3
View File
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
6442F6501C1FC3AA00C9152F /* XLFormImageCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6442F64E1C1FC3AA00C9152F /* XLFormImageCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
6442F6511C1FC3AA00C9152F /* XLFormImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6442F64F1C1FC3AA00C9152F /* XLFormImageCell.m */; };
E267FD7C1BE804E200F86B42 /* XLFormBaseCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD2C1BE804E200F86B42 /* XLFormBaseCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD7D1BE804E200F86B42 /* XLFormBaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD2D1BE804E200F86B42 /* XLFormBaseCell.m */; };
E267FD7E1BE804E200F86B42 /* XLFormButtonCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD2E1BE804E200F86B42 /* XLFormButtonCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -86,6 +88,8 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6442F64E1C1FC3AA00C9152F /* XLFormImageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormImageCell.h; sourceTree = "<group>"; };
6442F64F1C1FC3AA00C9152F /* XLFormImageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormImageCell.m; sourceTree = "<group>"; };
E267FD201BE8048900F86B42 /* XLForm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = XLForm.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E267FD251BE8048900F86B42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E267FD2C1BE804E200F86B42 /* XLFormBaseCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormBaseCell.h; sourceTree = "<group>"; };
@@ -223,6 +227,8 @@
E267FD341BE804E200F86B42 /* XLFormDatePickerCell.h */,
E267FD351BE804E200F86B42 /* XLFormDatePickerCell.m */,
E267FD361BE804E200F86B42 /* XLFormDescriptorCell.h */,
6442F64E1C1FC3AA00C9152F /* XLFormImageCell.h */,
6442F64F1C1FC3AA00C9152F /* XLFormImageCell.m */,
E267FD371BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h */,
E267FD381BE804E200F86B42 /* XLFormInlineSelectorCell.h */,
E267FD391BE804E200F86B42 /* XLFormInlineSelectorCell.m */,
@@ -376,6 +382,7 @@
E267FD981BE804E200F86B42 /* XLFormTextFieldCell.h in Headers */,
E267FD7C1BE804E200F86B42 /* XLFormBaseCell.h in Headers */,
E267FD861BE804E200F86B42 /* XLFormDescriptorCell.h in Headers */,
6442F6501C1FC3AA00C9152F /* XLFormImageCell.h in Headers */,
E267FDA01BE804E200F86B42 /* XLFormRowDescriptorViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -479,6 +486,7 @@
E267FD7F1BE804E200F86B42 /* XLFormButtonCell.m in Sources */,
E267FD911BE804E200F86B42 /* XLFormSelectorCell.m in Sources */,
E267FDA91BE804E200F86B42 /* XLFormSectionDescriptor.m in Sources */,
6442F6511C1FC3AA00C9152F /* XLFormImageCell.m in Sources */,
E267FD971BE804E200F86B42 /* XLFormSwitchCell.m in Sources */,
E267FDC61BE804E200F86B42 /* XLForm.m in Sources */,
E267FD891BE804E200F86B42 /* XLFormInlineSelectorCell.m in Sources */,
@@ -526,7 +534,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -553,7 +561,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3.0.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -567,7 +575,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";

Some files were not shown because too many files have changed in this diff Show More