136 Commits

Author SHA1 Message Date
Mathias Claassen bd2a64b881 update version to 3.1.0 2015-12-14 18:10:45 -03:00
Mathias Claassen 403a63ec1f Merge pull request #669 from xmartlabs/feature/buttonCellStyle
Button row style must not be default any more.
2015-12-14 18:01:03 -03:00
Mathias Claassen 4d3d916b07 Button row style must not be default any more.
Can display value on right of button cell.
Closes #595, fixes #
2015-12-14 17:59:48 -03:00
Martin Barreto 6ef46a6026 Merge pull request #668 from xmartlabs/feature/returnKeyType
fixed return key type so that it will be used by navigation. Fixes #180
2015-12-14 17:09:59 -03:00
Mathias Claassen 5f376c5e85 fixed return key type so that it will be used by navigation. Fixes #180 2015-12-14 16:33:45 -03:00
Mathias Claassen 0ca45c77c4 Merge pull request #667 from winzig/master
Adding Swift example code for XLFormRowDescriptorTypeImage
2015-12-14 14:30:49 -03:00
Tom Winzig 2c3c6f6089 Adding Swift example code for XLFormRowDescriptorTypeImage
Based on example code in pull request #645
2015-12-11 13:03:32 -08:00
Martin Barreto 31ecb76df2 Update Rakefile 2015-12-11 17:11:06 -03:00
Mathias Claassen e98e09c8c6 Merge pull request #665 from xmartlabs/feature/allowHttp
allow http connections
2015-12-11 17:03:21 -03:00
Mathias Claassen 82c6bf29e1 Merge pull request #568 from hariseldon78/patch-3
Update XLFormRowDescriptor.h
2015-12-11 16:56:14 -03:00
Mathias Claassen 772ab0c53e Merge pull request #565 from chrisballinger/cell_bundle
Support cell xibs in different bundle than class
2015-12-11 16:53:34 -03:00
Mathias Claassen 6aba1f17ed Merge pull request #666 from xmartlabs/fix/segueIdentifier
fix segueIdentifier name. Fixes #585
2015-12-11 14:55:39 -03:00
Mathias Claassen 970c64620d Update .travis.yml 2015-12-11 14:53:15 -03:00
Mathias Claassen ccffa8600b fix segueIdentifier name. Fixes #585 2015-12-11 14:48:10 -03:00
Mathias Claassen cb01471cdc allow http connections 2015-12-11 14:30:27 -03:00
Martin Barreto 103e71e508 Merge pull request #645 from bmichotte/XLFormRowDescriptorTypeImage
Add XLFormRowDescriptorTypeImage
2015-11-30 15:56:11 -03:00
Benjamin Michotte 77b119d4d5 Add XLFormRowDescriptorTypeImage 2015-11-15 13:01:25 +01:00
Martin Barreto f2d5882614 Merge pull request #563 from tommypeps/feature/XLFormOptionsObjectImplementNSCoding
add NSCoding protocol a XLFormOptionsObject class
2015-11-13 01:45:19 -03:00
Martin Barreto ac0d5991e0 improve RTL language support. 2015-11-13 00:33:28 -03:00
Martin Barreto 33715f3154 Merge pull request #641 from mbjacks/master
prevent XLFormInlineSelectorCell from removing the row beneath when not first responder
2015-11-12 20:37:12 -03:00
Matt Jackson cd506db478 prevent XLFormInlineSelectorCell from removing the row beneath when not first responder 2015-11-12 15:25:15 -08:00
Martin Barreto 9a89d1bd5c Merge pull request #640 from xmartlabs/pbeast-master
Pbeast master
2015-11-12 20:09:24 -03:00
Martin Barreto 8495a150ed close #632 2015-11-12 20:12:26 -03:00
Martin Barreto 8c4ecfb86b Merge pull request #635 from tomtaylor/carthage-support
Added framework and Carthage support
2015-11-12 19:01:54 -03:00
Martin Barreto 3661646d54 fix #629 2015-11-12 17:16:34 -03:00
Martin Barreto 3f1bb84308 upgrade travis Xcode version to 7 2015-11-12 16:46:12 -03:00
Martin Barreto 8c12875aa2 Merge pull request #639 from xmartlabs/fix/cellLayoutMargins
fix #554 and #628.
2015-11-12 15:50:54 -03:00
Martin Barreto fa203c250e fix #554 and #628. 2015-11-12 15:53:38 -03:00
Martin Barreto f60922b38a Merge pull request #577 from xmartlabs/fix/layoutConstraints554
fixed layout constraints when working with iPad or big iPhones. close…
2015-11-12 15:16:16 -03:00
Tom Taylor d18edfbae2 Tidied up master header, adding imports for missing public headers. 2015-11-07 13:59:20 +00:00
Tom Taylor 1347ce56ee Add Carthage documentation to README. 2015-11-07 13:51:06 +00:00
Tom Taylor 9dc985bf3b Add Carthage support. 2015-11-02 21:14:51 +00:00
Pavel Yankelevich 764e3f9bc6 XLFormButtonCell -> textLabel -> textAlignment changed to NSTextAlignmentNatural. Looks much better for RTL languages 2015-11-01 15:33:01 +02:00
Martin Barreto a4fc47d5b0 clean up swift example code 2015-09-30 12:58:23 -03:00
Martin Barreto 38ef82c4df clean up swift code. 2015-09-30 00:13:31 -03:00
Martin Barreto 53f60c3287 clean up swift example project 2015-09-29 18:02:05 -03:00
Martin Barreto 95fe4f2cbc Merge branch 'master' of github.com:xmartlabs/XLForm 2015-09-29 16:20:36 -03:00
Martin Barreto 19e286bee9 Merge pull request #590 from noodlewerk/develop
Update to Swift 2.0
2015-09-29 16:11:57 -03:00
Martin Barreto 0f83bf6e1b Xcode 7 changes 2015-09-29 16:03:32 -03:00
Martin Barreto 9d20dbbf42 Merge branch 'master' of github.com:xmartlabs/XLForm 2015-09-29 16:01:21 -03:00
Martin Barreto 7a602ab61b minor change 2015-09-29 16:01:12 -03:00
Martin Barreto 1904ca3e10 Announcing Eureka - Elegant iOS Forms in pure Swift 2 2015-09-29 12:56:33 -03:00
Bruno Scheele f521bce859 Update to Swift 2.0 2015-09-29 14:08:13 +02:00
Mathias Claassen f2d4146782 fixed layout constraints when working with iPad or big iPhones. closes #554. 2015-09-24 17:38:20 -03:00
Roberto Previdi 06fd66c537 Update XLFormRowDescriptor.h 2015-09-19 13:41:24 +02:00
mats-claassen 61430b0194 Merge pull request #557 from pdenis1/bug553
fixes #553. closes #553
2015-09-18 10:13:27 -03:00
Chris Ballinger ab8b4c979e Support cell xibs in different bundle than class 2015-09-17 19:54:58 -07:00
Jose Roldan Jimenez dbe81fe484 add NSCoding protocol a XLFormOptionsObject class 2015-09-17 12:38:36 +02:00
Martin Barreto 08eaf70f62 Merge pull request #560 from dfinzer/update-cell
Change XLFormDateCell to call update when value changes
2015-09-16 20:21:04 -03:00
Devin Finzer 134e764100 Change XLFormDateCell to call update when value changes, so that subclasses can change the UI properly 2015-09-16 16:01:00 -07:00
Phil Denis f2be2d3c29 fix bug 553 - Setting row of type XLFormRowDescriptorTypeSelectorPickerViewInline to disabled removes the next row from the form 2015-09-14 10:50:07 -06:00
Mathias Claassen e196fc711b Merge branch 'master' of github.com:xmartlabs/XLForm 2015-09-03 14:10:03 -03:00
Mathias Claassen 368501511d minor code cleanup 2015-09-03 14:09:52 -03:00
mats-claassen d88235b028 Merge pull request #536 from davidrothera/master
Add zipCode to XLFormRowDescriptorType's
2015-09-03 14:07:33 -03:00
David Rothera 23b93a1a70 Add zipCode to XLFormRowDescriptorType's 2015-09-03 12:46:47 +01:00
Martin Barreto 1738fb8e35 update version 2015-08-17 21:36:11 -03:00
Mathias Claassen c3be940cc4 updated readme for cell configuration 2015-08-17 14:44:01 -03:00
Mathias Claassen dddbb74e95 Readme FAQ update 2015-08-17 14:01:51 -03:00
mats-claassen ef90f35a0f Merge pull request #505 from xmartlabs/fix/issue485
Fix/issue485
2015-08-14 17:51:47 -03:00
Mathias Claassen c03878e656 Merge branch 'master' into fix/issue485 2015-08-14 17:51:05 -03:00
Mathias Claassen 853254d75e Updated inline picker scrolling algorithm
closes #485
2015-08-14 17:50:30 -03:00
mats-claassen 460b116018 Merge pull request #504 from xmartlabs/fix/issue497
Fixed selector push value update bug.
2015-08-14 12:43:30 -03:00
Mathias Claassen 6a501e21fb Fixed selector push value update bug.
closes #497
2015-08-14 12:41:40 -03:00
Martin Barreto 6725d0a9b4 call setNeedsUpdateConstraints to make sure updateConstraints method is called. fix #486 2015-08-02 17:01:26 -03:00
Martin Barreto daaf720c29 fix #484 2015-08-01 21:21:59 -03:00
Martin Barreto bcd9ef118e Merge pull request #482 from Cee/master
Fix a typo
2015-08-01 17:32:34 -03:00
Cee cb9d40ba3a Fix a typo 2015-08-01 23:48:27 +08:00
Martin Barreto afcf2071ed Merge pull request #481 from xmartlabs/fix/issue465
Fix/issue465
2015-07-31 21:29:57 -03:00
Mathias Claassen 12b7012a1b Updated fix. Added CountDownTimer to inline row list 2015-07-31 12:20:02 -03:00
Mathias Claassen 8632b5bb42 Fixed issue #465 2015-07-30 10:55:02 -03:00
Martin Barreto ff2d869ee0 Merge pull request #474 from xmartlabs/feature/newpod
new pod version v3.0.1
2015-07-29 15:37:15 -03:00
Martin Barreto 486595922f new pod versin v3.0.1 2015-07-29 15:37:49 -03:00
Martin Barreto 9138c413f1 Merge pull request #473 from xmartlabs/fix/issue393
Fix issue #393
2015-07-28 21:03:02 -03:00
Martin Barreto 96c0999bf7 Merge pull request #470 from xmartlabs/issue#325
Issue #325 fix
2015-07-28 21:00:47 -03:00
Martin Barreto 79c14e3346 Use the metadata to know which are the inline rows. 2015-07-28 20:57:55 -03:00
Martin Barreto a28b595abd Merge pull request #471 from xmartlabs/fix/predicateparsing
Added "()" characters to separators when parsing strings to form pred…
2015-07-28 20:29:42 -03:00
Mathias Claassen 9de19aa0d8 Fix issue #393 2015-07-28 15:28:50 -03:00
Martin Pastorin d2a99cf8ce Merge pull request #472 from xmartlabs/issue#168
issue #168 - set row's textfield length
2015-07-28 14:37:33 -03:00
pastorin 029d88a901 issue #168 - set row's textfield length 2015-07-28 14:33:15 -03:00
Mathias Claassen d454cc284d Added "()" characters to separators when parsing strings to form predicates 2015-07-28 11:49:11 -03:00
pastorin 612807d9c3 Issue #325 fix
Accessory view should not be displayed on Inline date pickers
2015-07-28 11:21:47 -03:00
Martin Barreto c8ebb733ce fix #434 2015-07-28 00:08:14 -03:00
Martin Barreto 175f10397b Merge pull request #467 from stevemoser/patch-1
Remove setting the root VC in init
2015-07-27 22:48:18 -03:00
mats-claassen 094715028c Merge pull request #469 from xmartlabs/fix/hiddenAndDisabledRows
on change block
2015-07-27 15:43:54 -03:00
Mathias Claassen 169f9f9778 Modified onChangeBlock to send rowDescriptor 2015-07-27 15:39:34 -03:00
Mathias Claassen 9bc80c6c0d on change block 2015-07-27 13:55:25 -03:00
Martin Barreto ecc9ec45fb Merge pull request #466 from xmartlabs/issue#460
issue #460 fix
2015-07-27 13:15:59 -03:00
mats-claassen d479a91f47 Merge pull request #468 from xmartlabs/fix/hiddenAndDisabledRows
Hidden and disabled rows resign first responder before changing state
2015-07-27 12:42:25 -03:00
Mathias Claassen 014030a99e Hidden and disabled rows resign first responder before changing state 2015-07-27 12:38:24 -03:00
Steve Moser deb34b01b0 Remove setting the root VC in init
For the event example it is already set in the storyboard so it is not needed here.
2015-07-27 11:15:14 -04:00
pastorin 79d9412ea3 issue #460 fix 2015-07-27 11:04:49 -03:00
Martin Barreto a2feb45ad7 Merge pull request #462 from AlexZd/master
[PATCH] Allow Developers to use XLForm in their Frameworks
2015-07-27 00:21:06 -03:00
Martin Barreto bea7afcb60 Merge pull request #458 from xmartlabs/AlertController
iOS8 and above - Replace UIAlertView and UIActionSheet for UIAlertController
2015-07-25 01:02:26 -03:00
Martin Barreto 1854bd49a4 minor fix. 2015-07-25 00:58:12 -03:00
Martin Barreto bb1d4bedc8 Use new Alert/Style controller class when possible. 2015-07-25 00:39:11 -03:00
Martin Barreto ebf4915899 fix doc typo 2015-07-24 16:24:00 -03:00
pastorin 22c8f06d43 iOS8 and above - Replace UIAlertView and UIActionSheet for UIAlertController 2015-07-24 15:13:53 -03:00
Martin Barreto 47aa759602 Merge pull request #455 from xmartlabs/StepCounterChanges
Improve StepCounter
2015-07-23 15:35:03 -03:00
pastorin da241efcc0 - Add StepCounter documentation
- Add StepCounter custom values example
- Fix XLFormStepCounterCell bug
2015-07-23 15:33:38 -03:00
Martin Barreto 09176bff39 Merge pull request #454 from xmartlabs/issue#398
issue #398 fix
2015-07-23 13:05:22 -03:00
Martin Barreto d3fc9b2093 Merge pull request #453 from xmartlabs/issue#386
issue #386 fix
2015-07-23 12:45:37 -03:00
pastorin 8c9351cd12 issue #398 fix 2015-07-23 12:37:26 -03:00
pastorin 560aec29c6 issue #386 fix 2015-07-23 11:27:18 -03:00
Martin Barreto 941f8fcfc3 Merge pull request #449 from xmartlabs/fix/TextFieldLayouts
Fix/text field layouts
2015-07-22 17:23:07 -03:00
pastorin 65c5431761 issue #409 fix 2015-07-22 17:18:34 -03:00
pastorin 1c1c95408f Merge branch 'master' of https://github.com/xmartlabs/XLForm into fix/TextFieldLayouts 2015-07-22 17:08:03 -03:00
Martin Pastorin cda07b2a64 Merge pull request #448 from xmartlabs/issue#429Constraints
issue #429 fix
2015-07-22 15:54:31 -03:00
pastorin 6fac42b190 issue #429 fix 2015-07-22 15:42:43 -03:00
Martin Barreto 4a641c4a7c Merge pull request #444 from openhood/keep-valueTransformer-on-copy
Ensure XLFormRowDescriptor valueTransform is kept on copy
2015-07-22 13:47:45 -03:00
Jonathan Tron a36ae6d90a Ensure XLFormRowDescriptor valueTransform is kept on copy 2015-07-22 17:38:16 +02:00
Martin Barreto 60657c0cf8 Merge pull request #441 from tommypeps/fixed#422
email long
2015-07-21 20:20:09 -03:00
Martin Barreto a114e9bda5 Merge pull request #440 from iOSCowboy/patch-1
Define 'DSL' in README file
2015-07-21 20:17:22 -03:00
Hector Zarate 4113135298 Define 'DSL' in README file 2015-07-21 22:55:12 +02:00
tommypeps 9503cbe8ed email long 2015-07-21 22:50:54 +02:00
Martin Barreto 36fa5e7071 Update README.md 2015-07-21 00:27:30 -03:00
Martin Barreto 6566ef81f8 Merge pull request #438 from xmartlabs/feature/swift1_2
Xcode 6.2 & swift1.2 support
2015-07-20 23:39:46 -03:00
Martin Barreto f019da0edc build version update. 2015-07-20 23:30:29 -03:00
Martin Barreto 20ca33e2e8 swift fixes. 2015-07-20 22:50:13 -03:00
mikeEllis 31f2fce646 swift 1.2 fixes 2015-07-20 17:19:00 -03:00
Martin Barreto 39280687e8 Merge pull request #432 from santiagofm/replace-xldataloader-with-xldata
replace xldataloader in objc examples with xldata
2015-07-17 16:52:41 -03:00
Santiago Fernandez 76b9d85154 update to xldata 2.0.0 2015-07-17 16:31:04 -03:00
Santiago Fernandez e6661b6526 replace xldataloader in objc examples with xldata 2015-07-16 10:58:02 -03:00
Martin Barreto 6e4574836b Merge branch 'master' of github.com:xmartlabs/XLForm 2015-07-15 01:25:29 -03:00
Martin Barreto 3822ed74e5 reload form whenever self.form is assigned. 2015-07-15 01:25:18 -03:00
Martin Barreto 49a2fb8f96 Merge pull request #425 from kevindeleon/patch-1
Fixes spelling error in requested change.
2015-07-14 12:55:35 -03:00
Martin Barreto 7929580f5d Merge pull request #427 from kevindeleon/patch-3
Figured these same spelling errors were here as well
2015-07-14 12:53:28 -03:00
Martin Barreto 03d8b0a35c Merge pull request #426 from kevindeleon/patch-2
fixes a few more spelling errors.
2015-07-14 12:53:07 -03:00
Kevin deLeon 7bbfab3c6b fixes a spelling error I missed. 2015-07-14 08:58:07 -05:00
Kevin deLeon 84a2f55609 Figured these same spelling errors were here as well 2015-07-14 08:55:36 -05:00
Kevin deLeon 8273745356 fixes a few more spelling errors. 2015-07-14 08:52:38 -05:00
Kevin deLeon 2e3e267bfe Fixes spelling error in requested change. 2015-07-14 08:50:01 -05:00
Martin Barreto 4c68391763 Update README.md 2015-07-10 22:34:06 -03:00
Sebastian Vogelsang 94f22d9b54 made textFields within XLFormTextFieldCells a min. width of 1/3 screen width. That way very long labels cannot squeeze the textField until input becomes impossible. Also labels are multi-line now. 2015-07-09 15:15:10 +02:00
Martin Barreto d94b027c17 minor example project fix. row tag (key) was wrong. 2015-06-20 11:24:00 -03:00
Martin Barreto 549a6be69f #389 2015-06-19 11:33:54 -03:00
AlexZd 3a71cfe6e2 [PATCH] Allow Developers to use XLForm in their Frameworks 2015-06-11 17:37:57 +04:00
106 changed files with 2819 additions and 1935 deletions
+1
View File
@@ -1,4 +1,5 @@
language: objective-c
osx_image: xcode7.2
before_install:
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
@@ -169,7 +169,7 @@ NSString * kAccessoryViewNotes = @"notes";
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Ckeck"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSection];
@@ -23,7 +23,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "CoreDataStore.h"
#import "ExamplesFormViewController.h"
#import "AppDelegate.h"
@@ -31,7 +31,6 @@
NSString * const XLFormRowDescriptorTypeFloatLabeledTextField = @"XLFormRowDescriptorTypeFloatLabeledTextField";
const static CGFloat kHMargin = 15.0f;
const static CGFloat kVMargin = 8.0f;
const static CGFloat kFloatingLabelFontSize = 11.0f;
@@ -155,10 +154,9 @@ const static CGFloat kFloatingLabelFontSize = 11.0f;
NSMutableArray * result = [[NSMutableArray alloc] init];
NSDictionary * views = @{@"floatLabeledTextField": self.floatLabeledTextField};
NSDictionary *metrics = @{@"hMargin":@(kHMargin),
@"vMargin":@(kVMargin)};
NSDictionary *metrics = @{@"vMargin":@(kVMargin)};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|"
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[floatLabeledTextField]-|"
options:0
metrics:metrics
views:views]];
@@ -1,8 +1,9 @@
<?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="8191" systemVersion="14F27" 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="8154"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -10,11 +11,12 @@
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="OGo-4x-YLf" customClass="XLFormRatingCell">
<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">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" 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">
<rect key="frame" x="353" y="11" width="115" height="22"/>
<rect key="frame" x="355" y="11" width="115" height="22"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="85e-Ov-qM7"/>
@@ -22,28 +24,21 @@
</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"/>
<rect key="frame" x="8" y="11" width="347" height="21"/>
<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>
<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 firstAttribute="trailingMargin" secondItem="yhI-dj-sRk" secondAttribute="trailing" id="W8E-PI-peE"/>
<constraint firstItem="Vxp-gw-YTt" firstAttribute="top" secondItem="hV6-xt-6pq" secondAttribute="top" constant="11" id="bgO-t8-Rjz"/>
<constraint firstItem="Vxp-gw-YTt" firstAttribute="leading" secondItem="hV6-xt-6pq" secondAttribute="leadingMargin" id="mVS-0p-p0O"/>
<constraint firstItem="yhI-dj-sRk" firstAttribute="leading" secondItem="Vxp-gw-YTt" secondAttribute="trailing" id="n0B-tg-Pik"/>
</constraints>
</tableViewCellContentView>
@@ -1,8 +1,9 @@
<?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="8191" systemVersion="14F27" 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="8154"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -10,11 +11,12 @@
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="60" id="piA-L5-eiN" customClass="XLFormWeekDaysCell">
<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">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" 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"/>
<rect key="frame" x="8" y="0.0" width="52" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -28,14 +30,14 @@
</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"/>
<rect key="frame" x="60" 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"/>
<rect key="frame" x="60" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="M">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -46,14 +48,14 @@
</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"/>
<rect key="frame" x="113" 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"/>
<rect key="frame" x="113" y="0.0" width="52" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -64,14 +66,14 @@
</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"/>
<rect key="frame" x="165" 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"/>
<rect key="frame" x="165" y="0.0" width="52" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="W">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -82,14 +84,14 @@
</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"/>
<rect key="frame" x="217" 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"/>
<rect key="frame" x="217" y="0.0" width="52" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="T">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -100,14 +102,14 @@
</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"/>
<rect key="frame" x="269" 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"/>
<rect key="frame" x="269" y="0.0" width="53" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="F">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -118,14 +120,14 @@
</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"/>
<rect key="frame" x="322" 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"/>
<rect key="frame" x="322" y="0.0" width="52" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="S">
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
@@ -137,15 +139,9 @@
</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="trailing" secondItem="Yr6-3E-keb" secondAttribute="trailingMargin" id="7Kc-RO-8KK"/>
<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"/>
@@ -153,87 +149,43 @@
<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 firstItem="ZAg-Me-yKR" firstAttribute="leading" secondItem="Yr6-3E-keb" secondAttribute="leadingMargin" id="w9K-VP-JpE"/>
<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"/>
@@ -244,7 +196,7 @@
<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"/>
<point key="canvasLocation" x="443" y="197"/>
</tableViewCell>
</objects>
</document>
@@ -75,8 +75,7 @@ NSString *const kCountDownTimer = @"countDownTimer";
dateComp.hour = 0;
dateComp.minute = 7;
dateComp.timeZone = [NSTimeZone systemTimeZone];
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
row.value = [calendar dateFromComponents:dateComp];
[section addFormRow:row];
@@ -158,13 +157,32 @@ NSString *const kCountDownTimer = @"countDownTimer";
[super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
if([formRow.tag isEqualToString:kDatePicker])
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
message:@"Value Has changed!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"DatePicker"
message:@"Value Has changed!"
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"DatePicker"
message:@"Value Has changed!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
}
#endif
}
}
@@ -89,7 +89,7 @@ NSString * const kValidations= @"Validations";
// NativeEventFormViewController
row = [XLFormRowDescriptor formRowDescriptorWithTag:@"realExamples" rowType:XLFormRowDescriptorTypeButton title:@"iOS Calendar Event Form"];
row.action.formSegueIdenfifier = @"NativeEventNavigationViewControllerSegue";
row.action.formSegueIdentifier = @"NativeEventNavigationViewControllerSegue";
[section addFormRow:row];
@@ -105,7 +105,7 @@ NSString * const kValidations= @"Validations";
// Selectors
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectors rowType:XLFormRowDescriptorTypeButton title:@"Selectors"];
row.action.formSegueIdenfifier = @"SelectorsFormViewControllerSegue";
row.action.formSegueIdentifier = @"SelectorsFormViewControllerSegue";
[section addFormRow:row];
// Dates
@@ -115,7 +115,7 @@ NSString * const kValidations= @"Validations";
// Others
row = [XLFormRowDescriptor formRowDescriptorWithTag:kOthes rowType:XLFormRowDescriptorTypeButton title:@"Other Rows"];
row.action.formSegueIdenfifier = @"OthersFormViewControllerSegue";
row.action.formSegueIdentifier = @"OthersFormViewControllerSegue";
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"Multivalued example"];
@@ -166,22 +166,22 @@ NSString * const kValidations= @"Validations";
[form addFormSection:section];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kValidations rowType:XLFormRowDescriptorTypeButton title:@"Validation Examples"];
row.action.formSegueIdenfifier = @"ValidationExamplesFormViewControllerSegue";
row.action.formSegueIdentifier = @"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";
row.action.formSegueIdentifier = @"BasicPredicateViewControllerSegue";
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Blog Example Hide predicates"];
row.action.formSegueIdenfifier = @"BlogExampleViewSegue";
row.action.formSegueIdentifier = @"BlogExampleViewSegue";
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kPredicates rowType:XLFormRowDescriptorTypeButton title:@"Another example"];
row.action.formSegueIdenfifier = @"PredicateFormViewControllerSegue";
row.action.formSegueIdentifier = @"PredicateFormViewControllerSegue";
[section addFormRow:row];
self.form = form;
@@ -30,6 +30,7 @@
NSString *const kName = @"name";
NSString *const kEmail = @"email";
NSString *const kTwitter = @"twitter";
NSString *const kZipCode = @"zipCode";
NSString *const kNumber = @"number";
NSString *const kInteger = @"integer";
NSString *const kDecimal = @"decimal";
@@ -72,6 +73,10 @@ NSString *const kNotes = @"notes";
row.value = @"@no_editable";
[section addFormRow:row];
// Zip Code
row = [XLFormRowDescriptor formRowDescriptorWithTag:kZipCode rowType:XLFormRowDescriptorTypeZipCode title:@"Zip Code"];
[section addFormRow:row];
// Number
row = [XLFormRowDescriptor formRowDescriptorWithTag:kNumber rowType:XLFormRowDescriptorTypeNumber title:@"Number"];
[section addFormRow:row];
@@ -129,8 +134,34 @@ NSString *const kNotes = @"notes";
return;
}
[self.tableView endEditing:YES];
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil) message:@"No errors found" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alertView show];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil)
message:@"No errors found"
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
#else
if ([UIAlertController class]){
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Valid Form", nil)
message:@"No errors found"
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Valid Form", nil)
message:@"No errors found"
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
}
#endif
}
@end
@@ -85,11 +85,67 @@
-(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];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel")
destructiveButtonTitle:@"Remove Last Section"
otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
[actionSheet showInView:self.view];
#else
if ([UIAlertController class]){
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil]];
__weak __typeof(self)weakSelf = self;
[alertController addAction:[UIAlertAction actionWithTitle:@"Remove Last Section"
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) {
if (weakSelf.form.formSections.count > 0){
// remove last section
[weakSelf.form removeFormSectionAtIndex:(weakSelf.form.formSections.count - 1)];
}
}]];
[alertController addAction:[UIAlertAction actionWithTitle:@"Add a section at the end"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
// 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_%@", @(weakSelf.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];
[weakSelf.form addFormSection:newSection];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:self.form.isDisabled ? @"Enable Form" : @"Disable Form"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
weakSelf.form.disabled = !weakSelf.form.disabled;
[weakSelf.tableView endEditing:YES];
[weakSelf.tableView reloadData];
}]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
destructiveButtonTitle:@"Remove Last Section"
otherButtonTitles:@"Add a section at the end", self.form.isDisabled ? @"Enable Form" : @"Disable Form", nil];
[actionSheet showInView:self.view];
}
#endif
}
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
@@ -109,13 +165,15 @@
[newSection addFormRow:newRow];
[self.form addFormSection:newSection];
}
else {
else if (![[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:NSLocalizedString(@"Cancel")]){
self.form.disabled = !self.form.disabled;
[self.tableView endEditing:YES];
[self.tableView reloadData];
}
}
#endif
@end
@@ -92,12 +92,57 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle delegate:self
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo"), NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture"), nil];
actionSheet.tag = self.tag;
[actionSheet showInView:self.formViewController.view];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil]];
__weak __typeof(self)weakSelf = self;
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = weakSelf;
imagePickerController.allowsEditing = YES;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
[weakSelf.formViewController presentViewController:imagePickerController animated:YES completion:nil];
}]];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = weakSelf;
imagePickerController.allowsEditing = YES;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
[weakSelf.formViewController presentViewController:imagePickerController animated:YES completion:nil];
}]];
[self.formViewController presentViewController:alertController animated:YES completion:nil];
}
else{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
destructiveButtonTitle:nil
otherButtonTitles:NSLocalizedString(@"XLFormImageSelectorCell_ChooseExistingPhoto", @"Choose Existing Photo"), NSLocalizedString(@"XLFormImageSelectorCell_TakePicture", @"Take a Picture"), nil];
actionSheet.tag = self.tag;
[actionSheet showInView:self.formViewController.view];
}
#endif
}
#pragma mark - LayoutConstraints
@@ -109,7 +154,7 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
NSDictionary *metrics = @{@"margin":@5.0};
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[text]" options:0 metrics:metrics views:uiComponents]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[text]" options:0 metrics:metrics views:uiComponents]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(margin)-[text]" options:0 metrics:metrics views:uiComponents]];
@@ -168,9 +213,14 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
[self.textLabel removeObserver:self forKeyPath:@"text"];
}
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
- (void)actionSheet:(UIActionSheet * __unused)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIImagePickerController * imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
@@ -187,6 +237,8 @@ NSString *const kFormImageSelectorCellImageRequest = @"imageRequest";
}
}
#endif
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
@@ -27,13 +27,14 @@
#import "OthersFormViewController.h"
NSString *const kSwitchBool = @"switchBool";
NSString *const kSwitchCheck = @"switchBool";
NSString *const kSwitchCheck = @"switchCheck";
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 kImage = @"image";
NSString *const kButtonLeftAligned = @"buttonLeftAligned";
NSString *const kButtonWithSegueId = @"buttonWithSegueId";
NSString *const kButtonWithSegueClass = @"buttonWithSegueClass";
@@ -44,7 +45,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
@implementation OthersFormViewController
- (instancetype)initWithCoder:(NSCoder *)coder
-(instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
@@ -53,7 +54,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
return self;
}
- (id)init
-(instancetype)init
{
self = [super init];
if (self){
@@ -79,10 +80,16 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kSwitchCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"]];
// step counter
[section addFormRow:[XLFormRowDescriptor formRowDescriptorWithTag:kStepCounter rowType:XLFormRowDescriptorTypeStepCounter title:@"Step counter"]];
XLFormRowDescriptor * 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"];
[row.cellConfigAtConfigure setObject:@10 forKey:@"stepControl.minimumValue"];
[row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
[section addFormRow:row];
// Segmented Control
XLFormRowDescriptor * row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSegmentedControl rowType:XLFormRowDescriptorTypeSelectorSegmentedControl title:@"Fruits"];
row.selectorOptions = @[@"Apple", @"Orange", @"Pear"];
row.value = @"Pear";
[section addFormRow:row];
@@ -96,6 +103,10 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
[row.cellConfigAtConfigure setObject:@(4) forKey:@"steps"];
[section addFormRow:row];
// Image
row = [XLFormRowDescriptor formRowDescriptorWithTag:kImage rowType:XLFormRowDescriptorTypeImage title:@"Image"];
row.value = [UIImage imageNamed:@"default_avatar"];
[section addFormRow:row];
// Info cell
XLFormRowDescriptor *infoRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:kInfo rowType:XLFormRowDescriptorTypeInfo];
@@ -110,22 +121,44 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
// 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:@(NSTextAlignmentNatural) forKey:@"textLabel.textAlignment"];
[buttonLeftAlignedRow.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
__typeof(self) __weak weakSelf = self;
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:weakSelf cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
[alertView show];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
delegate:weakSelf
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
delegate:weakSelf
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
}
#endif
}
[weakSelf deselectFormRow:sender];
};
@@ -140,7 +173,7 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
// Button with SegueId
XLFormRowDescriptor * buttonWithSegueId = [XLFormRowDescriptor formRowDescriptorWithTag:kButtonWithSegueClass rowType:XLFormRowDescriptorTypeButton title:@"Button with Segue Idenfifier"];
buttonWithSegueId.action.formSegueIdenfifier = @"MapViewControllerSegue";
buttonWithSegueId.action.formSegueIdentifier = @"MapViewControllerSegue";
[section addFormRow:buttonWithSegueId];
@@ -162,8 +195,33 @@ NSString *const kButtonWithStoryboardId = @"buttonWithStoryboardId";
-(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];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView *message = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Switch is ON", nil)
message:@"Button has checked the switch value..."
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[message show];
}
#endif
}
[self deselectFormRow:sender];
}
@@ -103,11 +103,14 @@ NSString *const kPredDep2 = @"preddep2";
[section addFormRow:row];
row.hidden = [NSString stringWithFormat:@"$%@.isDisabled == 1 AND $%@.value contains[c] 'Out'", pred4, pred];
typeof(self) __weak weakself = self;
row.onChangeBlock = ^(id oldValue, id newValue, XLFormRowDescriptor* __unused rowDescriptor){
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Account Field changed" message:[NSString stringWithFormat:@"Old value: %@\nNew value: %@", oldValue, newValue ] preferredStyle:UIAlertControllerStyleActionSheet];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:nil]];
[weakself.navigationController presentViewController:alert animated:YES completion:nil];
};
self.form = form;
}
@end
@@ -30,12 +30,6 @@
@implementation NativeEventNavigationViewController
-(id)init
{
self = [super initWithRootViewController:[[NativeEventFormViewController alloc] init]];
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
@@ -29,8 +29,31 @@
NSString *const kSelectorUser = @"selectorUser";
NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
@implementation DynamicSelectorsFormViewController
@interface UserTransformer : NSValueTransformer
@end
@implementation UserTransformer
+ (Class)transformedValueClass
{
return [NSString class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
if (!value) return nil;
NSDictionary *user = (NSDictionary *) value;
return [user valueForKeyPath:@"user.name"];
}
@end
@implementation DynamicSelectorsFormViewController
-(id)init
{
@@ -48,19 +71,24 @@ NSString *const kSelectorUserPopover = @"kSelectorUserPopover";
// Selector Push
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorUser rowType:XLFormRowDescriptorTypeSelectorPush title:@"User"];
row.action.viewControllerClass = [UsersTableViewController class];
row.action.viewControllerStoryboardId = @"UsersTableViewController";
row.valueTransformer = [UserTransformer 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];
}
// 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;
}
- (UIStoryboard *)storyboardForRow:(XLFormRowDescriptor *)formRow
{
return [UIStoryboard storyboardWithName:@"iPhoneStoryboard" bundle:nil];
}
@end
@@ -24,8 +24,11 @@
// THE SOFTWARE.
#import "XLFormRowDescriptor.h"
#import "XLTableViewController.h"
#import "XLRemoteDataStoreController.h"
@interface UsersTableViewController : XLTableViewController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
@interface UsersTableViewController : XLRemoteDataStoreController <XLFormRowDescriptorViewController, XLFormRowDescriptorPopoverViewController>
@end
@property BOOL isSearchResultsController;
@property NSLayoutConstraint *topConstraint;
@end
@@ -24,9 +24,7 @@
// THE SOFTWARE.
#import "UsersTableViewController.h"
#import "UserLocalDataLoader.h"
#import "UserRemoteDataLoader.h"
#import "User+Additions.h"
#import "HTTPSessionManager.h"
// AFNetworking
#import <AFNetworking/UIImageView+AFNetworking.h>
@@ -65,7 +63,6 @@
// Configure the view for the selected state
}
#pragma mark - Views
-(UIImageView *)userImage
@@ -101,7 +98,7 @@
NSDictionary *metrics = @{@"imgSize":@50.0,
@"margin" :@12.0};
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(margin)-[image(imgSize)]-[name]"
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[image(imgSize)]-[name]"
options:NSLayoutFormatAlignAllTop
metrics:metrics
views:views]];
@@ -110,6 +107,7 @@
options:0
metrics:metrics
views:views]];
return result;
}
@@ -117,56 +115,69 @@
@end
@interface UsersTableViewController ()
@interface UsersTableViewController () <UISearchControllerDelegate>
@property (nonatomic, readonly) UsersTableViewController * searchResultController;
@property (nonatomic, readonly) UISearchController * searchController;
@end
@implementation UsersTableViewController
@synthesize rowDescriptor = _rowDescriptor;
@synthesize popoverController = __popoverController;
@synthesize searchController = _searchController;
@synthesize searchResultController = _searchResultController;
static NSString *const kCellIdentifier = @"CellIdentifier";
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
self = [super initWithCoder:coder];
if (self) {
// Custom initialization
[self initialize];
}
return self;
}
-(void)initialize
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
// Enable the pagination
self.loadingPagingEnabled = YES;
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self)
{
[self initialize];
}
// 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]];
return self;
}
- (void)initialize
{
self.dataLoader = [[XLDataLoader alloc] initWithURLString:@"/mobile/users.json" offsetParamName:@"offset" limitParamName:@"limit" searchStringParamName:@"filter"];
self.dataLoader.delegate = self;
self.dataLoader.storeDelegate = self;
self.dataLoader.limit = 4;
self.dataLoader.collectionKeyPath = @"";
}
- (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.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
[self customizeAppearance];
if (!self.isSearchResultsController){
self.tableView.tableHeaderView = self.searchController.searchBar;
}
else{
[self.tableView setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
[self.tableView setScrollIndicatorInsets:self.tableView.contentInset];
}
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.searchController.searchBar sizeToFit];
}
#pragma mark - UITableViewDataSource
@@ -174,49 +185,28 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
- (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];
}
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
cell.userName.text = [dataItem valueForKeyPath:@"user.name"];
[cell.userImage setImageWithURL:[NSURL URLWithString:[dataItem valueForKeyPath:@"user.imageURL"]] placeholderImage:[UIImage imageNamed:@"default-avatar"]];
cell.accessoryType = [[self.rowDescriptor.value valueForKeyPath:@"user.id"] isEqual:[dataItem valueForKeyPath:@"user.id"]] ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
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;
}
#pragma mark - UITableViewDelegate
- (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;
NSDictionary *dataItem = [self.dataStore dataAtIndexPath:indexPath];
self.rowDescriptor.value = dataItem;
if (self.popoverController){
[self.popoverController dismissPopoverAnimated:YES];
@@ -227,19 +217,36 @@ static NSString *const kCellIdentifier = @"CellIdentifier";
}
}
#pragma mark - XLDataLoaderDelegate
#pragma mark - Helpers
-(void)customizeAppearance
-(AFHTTPSessionManager *)sessionManagerForDataLoader:(XLDataLoader *)dataLoader
{
[[self navigationItem] setTitle:@"Select a User"];
return [HTTPSessionManager sharedClient];
}
#pragma mark - UISearchController
-(UISearchController *)searchController
{
if (_searchController) return _searchController;
[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]];
self.definesPresentationContext = YES;
_searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultController];
_searchController.delegate = self;
_searchController.searchResultsUpdater = self.searchResultController;
_searchController.searchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[_searchController.searchBar sizeToFit];
return _searchController;
}
@end
-(UsersTableViewController *)searchResultController
{
if (_searchResultController) return _searchResultController;
_searchResultController = [[UsersTableViewController alloc]init];
_searchResultController.dataLoader.limit = 0; // no paging in search result
_searchResultController.isSearchResultsController = YES;
return _searchResultController;
}
@end
@@ -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,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
@@ -332,8 +332,8 @@ NSString *const kSelectorWithStoryboardId = @"selectorWithStoryboardId";
[section addFormRow:row];
// selector with SegueId
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueId rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Idenfifier"];
row.action.formSegueIdenfifier = @"MapViewControllerSegue";
row = [XLFormRowDescriptor formRowDescriptorWithTag:kSelectorWithSegueId rowType:XLFormRowDescriptorTypeSelectorPush title:@"Selector with Segue Identifier"];
row.action.formSegueIdentifier = @"MapViewControllerSegue";
row.valueTransformer = [CLLocationValueTrasformer class];
row.value = [[CLLocation alloc] initWithLatitude:-33 longitude:-56];
[section addFormRow:row];
@@ -1,8 +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="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="p4n-1v-pzo">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
@@ -13,6 +13,7 @@
<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"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
@@ -32,8 +33,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -60,9 +62,11 @@
<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"/>
<animations/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<animations/>
<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"/>
@@ -94,9 +98,11 @@
<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"/>
<animations/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<animations/>
<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"/>
@@ -130,8 +136,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -155,9 +162,11 @@
<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"/>
<animations/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<animations/>
<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"/>
@@ -186,8 +195,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -206,8 +216,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -229,8 +240,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -248,6 +260,7 @@
<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"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
@@ -256,7 +269,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eqB-vl-BzH" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="588" y="-635"/>
<point key="canvasLocation" x="586" y="-654"/>
</scene>
<!--Basic Predicate View Controller-->
<scene sceneID="pD4-sm-x3a">
@@ -267,8 +280,9 @@
<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="504"/>
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout" bottom="YES"/>
@@ -278,13 +292,44 @@
</objects>
<point key="canvasLocation" x="-159" y="1151"/>
</scene>
<!--Users Table View Controller-->
<scene sceneID="lGi-0L-kUk">
<objects>
<viewController storyboardIdentifier="UsersTableViewController" automaticallyAdjustsScrollViewInsets="NO" definesPresentationContext="YES" modalPresentationStyle="currentContext" id="MON-q2-1DB" customClass="UsersTableViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="at2-Ds-EcY"/>
<viewControllerLayoutGuide type="bottom" id="uVG-bI-IMr"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="sMH-hT-NCg">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView autoresizesSubviews="NO" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="fLo-Gu-rqr">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<animations/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="uVG-bI-IMr" firstAttribute="top" secondItem="fLo-Gu-rqr" secondAttribute="bottom" id="25A-HG-wek"/>
<constraint firstItem="fLo-Gu-rqr" firstAttribute="top" secondItem="at2-Ds-EcY" secondAttribute="bottom" id="3N4-a2-LLf"/>
<constraint firstAttribute="trailing" secondItem="fLo-Gu-rqr" secondAttribute="trailing" id="IXV-p6-sAw"/>
<constraint firstItem="fLo-Gu-rqr" firstAttribute="leading" secondItem="sMH-hT-NCg" secondAttribute="leading" id="Xjr-w6-wlu"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="LIq-iZ-ILx"/>
<connections>
<outlet property="tableView" destination="fLo-Gu-rqr" id="2ES-0n-eVG"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="flB-2M-8zS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1346" y="1178"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
<segue reference="wAD-tS-AFZ"/>
<segue reference="Mtw-x2-E0b"/>
</inferredMetricsTieBreakers>
</document>
@@ -89,7 +89,7 @@ NSString * const kValidationInteger = @"kInteger";
// number Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Numbers"];
section.footerTitle = @"grather than 50 and less than 100";
section.footerTitle = @"greater than 50 and less than 100";
[formDescriptor addFormSection:section];
// Integer
@@ -97,7 +97,7 @@ NSString * const kValidationInteger = @"kInteger";
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = YES;
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"grather than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"greater than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
[section addFormRow:row];
self.form = formDescriptor;
+2 -2
View File
@@ -1,10 +1,10 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
platform :ios, '8.0'
pod 'XLForm', :path => '../../'
#Following pods are used for custom row examples
pod 'AFNetworking', '~> 2.0', :inhibit_warnings => true
pod 'XLDataLoader', '~> 1.1', :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
@@ -27,13 +27,6 @@
28815E2E1A8589F600B674D2 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28815E2D1A8589F600B674D2 /* MapViewController.xib */; };
28A7661F193248BD00D69546 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A7661E193248BD00D69546 /* CoreData.framework */; };
28A76625193251E500D69546 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A76624193251E500D69546 /* AppDelegate.m */; };
28A7662E1932E98A00D69546 /* HTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7662D1932E98A00D69546 /* HTTPSessionManager.m */; };
28A7663B1932EA1F00D69546 /* UserLocalDataLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766361932EA1F00D69546 /* UserLocalDataLoader.m */; };
28A7663C1932EA1F00D69546 /* UserRemoteDataLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */; };
28A766451932EC9C00D69546 /* CoreDataStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766401932EC9C00D69546 /* CoreDataStore.m */; };
28A766461932EC9C00D69546 /* User+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766421932EC9C00D69546 /* User+Additions.m */; };
28A7664A1932ED3400D69546 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 28A766481932ED3400D69546 /* Model.xcdatamodeld */; };
28A7664D1932EE0B00D69546 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7664C1932EE0B00D69546 /* User.m */; };
28A766551932F22400D69546 /* UsersTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A766541932F22400D69546 /* UsersTableViewController.m */; };
28A7665E1932F61100D69546 /* DynamicSelectorsFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A7665D1932F61100D69546 /* DynamicSelectorsFormViewController.m */; };
28A8083E190D9083009D77F8 /* iPhoneStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 28A8083D190D9083009D77F8 /* iPhoneStoryboard.storyboard */; };
@@ -43,7 +36,6 @@
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 */; };
3C3B01D61AB741EF0027CD45 /* XLFormRatingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D41AB741EF0027CD45 /* XLFormRatingCell.xib */; };
3C3B01DA1AB7497D0027CD45 /* XLFormWeekDaysCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01D81AB7497D0027CD45 /* XLFormWeekDaysCell.m */; };
3C3B01DB1AB7497D0027CD45 /* XLFormWeekDaysCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D91AB7497D0027CD45 /* XLFormWeekDaysCell.xib */; };
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01E01AB7499A0027CD45 /* XLRatingView.m */; };
@@ -52,8 +44,10 @@
66B6266E1AE0055100007886 /* DateAndTimeValueTrasformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.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 */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -92,19 +86,6 @@
28815E2D1A8589F600B674D2 /* MapViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MapViewController.xib; path = Examples/Selectors/CustomSelectors/XLFormRowViewController/MapViewController.xib; sourceTree = "<group>"; };
28A7661E193248BD00D69546 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
28A76624193251E500D69546 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Examples/AppDelegate.m; sourceTree = "<group>"; };
28A7662C1932E98A00D69546 /* HTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSessionManager.h; path = Examples/Selectors/Helpers/HTTPSessionManager.h; sourceTree = "<group>"; };
28A7662D1932E98A00D69546 /* HTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HTTPSessionManager.m; path = Examples/Selectors/Helpers/HTTPSessionManager.m; sourceTree = "<group>"; };
28A766351932EA1F00D69546 /* UserLocalDataLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserLocalDataLoader.h; sourceTree = "<group>"; };
28A766361932EA1F00D69546 /* UserLocalDataLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserLocalDataLoader.m; sourceTree = "<group>"; };
28A766371932EA1F00D69546 /* UserRemoteDataLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserRemoteDataLoader.h; sourceTree = "<group>"; };
28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserRemoteDataLoader.m; sourceTree = "<group>"; };
28A7663F1932EC9C00D69546 /* CoreDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreDataStore.h; sourceTree = "<group>"; };
28A766401932EC9C00D69546 /* CoreDataStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CoreDataStore.m; sourceTree = "<group>"; };
28A766411932EC9C00D69546 /* User+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "User+Additions.h"; sourceTree = "<group>"; };
28A766421932EC9C00D69546 /* User+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "User+Additions.m"; sourceTree = "<group>"; };
28A766491932ED3400D69546 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
28A7664B1932EE0B00D69546 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = "<group>"; };
28A7664C1932EE0B00D69546 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = "<group>"; };
28A766531932F22400D69546 /* UsersTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UsersTableViewController.h; path = Examples/Selectors/DynamicSelector/UsersTableViewController.h; sourceTree = "<group>"; };
28A766541932F22400D69546 /* UsersTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UsersTableViewController.m; path = Examples/Selectors/DynamicSelector/UsersTableViewController.m; sourceTree = "<group>"; };
28A7665C1932F61100D69546 /* DynamicSelectorsFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicSelectorsFormViewController.h; path = Examples/Selectors/DynamicSelector/DynamicSelectorsFormViewController.h; sourceTree = "<group>"; };
@@ -141,6 +122,8 @@
BFE91AFA1AE159B200DE5231 /* BasicPredicateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BasicPredicateViewController.m; path = Examples/PredicateExamples/BasicPredicateViewController.m; sourceTree = SOURCE_ROOT; };
D51B8B2A19126664008C0478 /* XLFormCustomCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLFormCustomCell.h; path = Examples/Others/CustomCells/XLFormCustomCell.h; sourceTree = "<group>"; };
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; };
/* End PBXFileReference section */
@@ -223,7 +206,6 @@
children = (
283B59AF19531DDA000828CD /* CustomSelectors */,
28A766521932F1FA00D69546 /* DynamicSelector */,
28A7662B1932E92D00D69546 /* Helpers */,
2843EB4918D496F600F13E2B /* SelectorsFormViewController.h */,
2843EB4A18D496F600F13E2B /* SelectorsFormViewController.m */,
);
@@ -355,55 +337,10 @@
name = CustomCells;
sourceTree = "<group>";
};
28A7662B1932E92D00D69546 /* Helpers */ = {
isa = PBXGroup;
children = (
28A7663D1932EC9C00D69546 /* Data */,
28A766301932EA1F00D69546 /* DataLoaders */,
28A7662C1932E98A00D69546 /* HTTPSessionManager.h */,
28A7662D1932E98A00D69546 /* HTTPSessionManager.m */,
);
name = Helpers;
sourceTree = "<group>";
};
28A766301932EA1F00D69546 /* DataLoaders */ = {
isa = PBXGroup;
children = (
28A766351932EA1F00D69546 /* UserLocalDataLoader.h */,
28A766361932EA1F00D69546 /* UserLocalDataLoader.m */,
28A766371932EA1F00D69546 /* UserRemoteDataLoader.h */,
28A766381932EA1F00D69546 /* UserRemoteDataLoader.m */,
);
name = DataLoaders;
path = Examples/Selectors/Helpers/DataLoaders;
sourceTree = "<group>";
};
28A7663D1932EC9C00D69546 /* Data */ = {
isa = PBXGroup;
children = (
28A7663E1932EC9C00D69546 /* Store */,
28A766411932EC9C00D69546 /* User+Additions.h */,
28A766421932EC9C00D69546 /* User+Additions.m */,
28A766481932ED3400D69546 /* Model.xcdatamodeld */,
28A7664B1932EE0B00D69546 /* User.h */,
28A7664C1932EE0B00D69546 /* User.m */,
);
name = Data;
path = Examples/Selectors/Helpers/Data;
sourceTree = "<group>";
};
28A7663E1932EC9C00D69546 /* Store */ = {
isa = PBXGroup;
children = (
28A7663F1932EC9C00D69546 /* CoreDataStore.h */,
28A766401932EC9C00D69546 /* CoreDataStore.m */,
);
path = Store;
sourceTree = "<group>";
};
28A766521932F1FA00D69546 /* DynamicSelector */ = {
isa = PBXGroup;
children = (
DEA6EF8E1B57D698000F4893 /* SessionManager */,
28A7665A1932F55700D69546 /* XLFormRowViewController */,
28A7665C1932F61100D69546 /* DynamicSelectorsFormViewController.h */,
28A7665D1932F61100D69546 /* DynamicSelectorsFormViewController.m */,
@@ -502,6 +439,15 @@
path = Examples/PredicateDisabling;
sourceTree = "<group>";
};
DEA6EF8E1B57D698000F4893 /* SessionManager */ = {
isa = PBXGroup;
children = (
DEA6EF8F1B57D6CC000F4893 /* HTTPSessionManager.h */,
DEA6EF901B57D6CC000F4893 /* HTTPSessionManager.m */,
);
name = SessionManager;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -514,6 +460,7 @@
2850C5F518D0F706002B7D0A /* Frameworks */,
2850C5F618D0F706002B7D0A /* Resources */,
CFE72E068B5F4D9BB45FB757 /* Copy Pods Resources */,
734CC62A7A974D37CC982576 /* Embed Pods Frameworks */,
);
buildRules = (
);
@@ -530,7 +477,7 @@
2850C5F018D0F706002B7D0A /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Xmartlabs;
};
buildConfigurationList = 2850C5F318D0F706002B7D0A /* Build configuration list for PBXProject "XLForm" */;
@@ -557,10 +504,10 @@
files = (
28468EA718EF594900DBB015 /* Localizable.strings in Resources */,
2850C60618D0F706002B7D0A /* InfoPlist.strings in Resources */,
BFA5F4B11BB48F8E00D045BD /* XLFormRatingCell.xib in Resources */,
28815E2E1A8589F600B674D2 /* MapViewController.xib in Resources */,
3C0357F01AB0D82300200C8A /* Images.xcassets in Resources */,
3C3B01DB1AB7497D0027CD45 /* XLFormWeekDaysCell.xib in Resources */,
3C3B01D61AB741EF0027CD45 /* XLFormRatingCell.xib in Resources */,
28A8083E190D9083009D77F8 /* iPhoneStoryboard.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -583,6 +530,21 @@
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;
@@ -608,15 +570,12 @@
283B59B7195334AF000828CD /* CustomSelectorsFormViewController.m in Sources */,
28A766551932F22400D69546 /* UsersTableViewController.m in Sources */,
3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */,
28A7663B1932EA1F00D69546 /* UserLocalDataLoader.m in Sources */,
DEA6EF911B57D6CC000F4893 /* HTTPSessionManager.m in Sources */,
282EB27C1AB5FF33004A736F /* AccessoryViewFormViewController.m in Sources */,
BF9DB1D51AE0436600B985E7 /* BlogExampleViewController.m in Sources */,
2850C60818D0F706002B7D0A /* main.m in Sources */,
D51B8B2C19126664008C0478 /* XLFormCustomCell.m in Sources */,
28A7664D1932EE0B00D69546 /* User.m in Sources */,
28A7664A1932ED3400D69546 /* Model.xcdatamodeld in Sources */,
3C3B01F01AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m in Sources */,
28A766461932EC9C00D69546 /* User+Additions.m in Sources */,
28DBB04118D76FDC00FB8A8B /* MultivaluedFormViewController.m in Sources */,
28A85D5918E346C100E81A26 /* XLFormImageSelectorCell.m in Sources */,
28468E9818EC686500DBB015 /* NativeEventFormViewController.m in Sources */,
@@ -629,12 +588,9 @@
2843EB5618D4F7B700F13E2B /* DatesFormViewController.m in Sources */,
283C6B7D1999BAF100A5283D /* UICustomizationFormViewController.m in Sources */,
3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */,
28A7662E1932E98A00D69546 /* HTTPSessionManager.m in Sources */,
283B59B219532415000828CD /* MapViewController.m in Sources */,
2843EB4718D4915800F13E2B /* ExamplesFormViewController.m in Sources */,
28A766451932EC9C00D69546 /* CoreDataStore.m in Sources */,
BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */,
28A7663C1932EA1F00D69546 /* UserRemoteDataLoader.m in Sources */,
BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */,
2843EB5218D4CFC700F13E2B /* OthersFormViewController.m in Sources */,
2843EB4B18D496F600F13E2B /* SelectorsFormViewController.m in Sources */,
@@ -683,6 +639,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -697,7 +654,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -729,7 +686,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
@@ -744,7 +701,8 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
@@ -760,7 +718,8 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "XLForm/XLForm-Prefix.pch";
INFOPLIST_FILE = "XLForm/XLForm-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
@@ -789,19 +748,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCVersionGroup section */
28A766481932ED3400D69546 /* Model.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
28A766491932ED3400D69546 /* Model.xcdatamodel */,
);
currentVersion = 28A766491932ED3400D69546 /* Model.xcdatamodel */;
path = Model.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
};
/* End XCVersionGroup section */
};
rootObject = 2850C5F018D0F706002B7D0A /* Project object */;
}
@@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
@@ -9,7 +14,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -17,11 +22,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0.1</string>
<string>3.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.0.1</string>
<string>3.0.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
@@ -170,7 +170,7 @@ NSString * kAccessoryViewNotes = @"notes";
[row.cellConfigAtConfigure setObject:@"TEXT VIEW EXAMPLE" forKey:@"textView.placeholder"];
[section addFormRow:row];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Ckeck"];
row = [XLFormRowDescriptor formRowDescriptorWithTag:kAccessoryViewCheck rowType:XLFormRowDescriptorTypeBooleanCheck title:@"Check"];
[section addFormRow:row];
section = [XLFormSectionDescriptor formSectionWithTitle:@"TextView With Label Example"];
@@ -24,12 +24,12 @@
class CustomRowsViewController : XLFormViewController {
private enum Tags : String {
case CustomRowFirstRatingTag = "CustomRowFirstRatingTag"
case CustomRowSecondRatingTag = "CustomRowSecondRatingTag"
case CustomRowFloatLabeledTextFieldTag = "CustomRowFloatLabeledTextFieldTag"
case CustomRowWeekdays = "CustomRowWeekdays"
case CustomRowText = "CustomText"
private struct Tags {
static let CustomRowFirstRatingTag = "CustomRowFirstRatingTag"
static let CustomRowSecondRatingTag = "CustomRowSecondRatingTag"
static let CustomRowFloatLabeledTextFieldTag = "CustomRowFloatLabeledTextFieldTag"
static let CustomRowWeekdays = "CustomRowWeekdays"
static let CustomRowText = "CustomText"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
@@ -37,7 +37,7 @@ class CustomRowsViewController : XLFormViewController {
self.initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
@@ -54,11 +54,11 @@ class CustomRowsViewController : XLFormViewController {
section.title = "Ratings"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomRowFirstRatingTag.rawValue, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
row = XLFormRowDescriptor(tag: Tags.CustomRowFirstRatingTag, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
row.value = 3
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.CustomRowSecondRatingTag.rawValue, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
row = XLFormRowDescriptor(tag: Tags.CustomRowSecondRatingTag, rowType: XLFormRowDescriptorTypeRate, title: "First Rating")
row.value = 1
section.addFormRow(row)
@@ -66,13 +66,13 @@ class CustomRowsViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Float Labeled Text Field")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag.rawValue, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Title")
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Title")
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag.rawValue, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "First Name")
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "First Name")
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag.rawValue, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Last Name")
row = XLFormRowDescriptor(tag: Tags.CustomRowFloatLabeledTextFieldTag, rowType: XLFormRowDescriptorTypeFloatLabeledTextField, title: "Last Name")
section.addFormRow(row)
@@ -80,7 +80,7 @@ class CustomRowsViewController : XLFormViewController {
form.addFormSection(section)
// WeekDays
row = XLFormRowDescriptor(tag: Tags.CustomRowWeekdays.rawValue, rowType: XLFormRowDescriptorTypeWeekDays, title: nil)
row = XLFormRowDescriptor(tag: Tags.CustomRowWeekdays, rowType: XLFormRowDescriptorTypeWeekDays)
row.value = [
XLFormWeekDaysCell.kWeekDay.Sunday.description(): false,
XLFormWeekDaysCell.kWeekDay.Monday.description(): true,
@@ -97,7 +97,7 @@ class CustomRowsViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomRowText.rawValue, rowType: XLFormRowDescriptorTypeCustom)
row = XLFormRowDescriptor(tag: Tags.CustomRowText, rowType: XLFormRowDescriptorTypeCustom)
// Must set custom cell or add custom cell to cellClassesForRowDescriptorTypes dictionary before XLFormViewController loaded
row.cellClass = XLFormCustomCell.self
section.addFormRow(row)
@@ -33,11 +33,11 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
lazy var floatLabeledTextField: JVFloatLabeledTextField = {
let result = JVFloatLabeledTextField(frame: CGRect.zeroRect)
result.setTranslatesAutoresizingMaskIntoConstraints(false)
let result = JVFloatLabeledTextField(frame: CGRect.zero)
result.translatesAutoresizingMaskIntoConstraints = false
result.font = UIFont.systemFontOfSize(kFontSize)
result.floatingLabel.font = UIFont.boldSystemFontOfSize(kFontSize)
result.clearButtonMode = UITextFieldViewMode.WhileEditing
result.floatingLabel.font = .boldSystemFontOfSize(kFontSize)
result.clearButtonMode = .WhileEditing
return result
}()
@@ -45,29 +45,30 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
override func configure() {
super.configure()
self.selectionStyle = UITableViewCellSelectionStyle.None
self.contentView.addSubview(self.floatLabeledTextField)
self.floatLabeledTextField.delegate = self
self.contentView.addConstraints(self.layoutConstraints())
selectionStyle = .None
contentView.addSubview(self.floatLabeledTextField)
floatLabeledTextField.delegate = self
contentView.addConstraints(layoutConstraints())
}
override func update() {
super.update()
self.floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: self.rowDescriptor.title, attributes: [NSForegroundColorAttributeName: UIColor.lightGrayColor()])
if let value: AnyObject = self.rowDescriptor.value {
self.floatLabeledTextField.text = value.displayText()
if let rowDescriptor = rowDescriptor {
floatLabeledTextField.attributedPlaceholder = NSAttributedString(string: rowDescriptor.title ?? "" , attributes: [NSForegroundColorAttributeName: UIColor.lightGrayColor()])
if let value = rowDescriptor.value {
floatLabeledTextField.text = value.displayText()
}
else {
floatLabeledTextField.text = rowDescriptor.noValueDisplayText
}
floatLabeledTextField.enabled = !rowDescriptor.isDisabled()
floatLabeledTextField.floatingLabelTextColor = .lightGrayColor()
floatLabeledTextField.alpha = rowDescriptor.isDisabled() ? 0.6 : 1.0
}
else {
self.floatLabeledTextField.text = self.rowDescriptor.noValueDisplayText
}
self.floatLabeledTextField.enabled = !self.rowDescriptor.isDisabled()
self.floatLabeledTextField.floatingLabelTextColor = UIColor.lightGrayColor()
self.floatLabeledTextField.alpha = self.rowDescriptor.isDisabled() ? 0.6 : 1.0
}
override func formDescriptorCellCanBecomeFirstResponder() -> Bool {
return !self.rowDescriptor.isDisabled()
return rowDescriptor?.isDisabled() == false
}
@@ -82,23 +83,22 @@ class FloatLabeledTextFieldCell : XLFormBaseCell, UITextFieldDelegate {
//MARK: Helpers
func layoutConstraints() -> [AnyObject]{
let views = ["floatLabeledTextField" : self.floatLabeledTextField]
func layoutConstraints() -> [NSLayoutConstraint]{
let views = ["floatLabeledTextField" : floatLabeledTextField]
let metrics = ["hMargin": 15.0, "vMargin": 8.0]
var result = NSLayoutConstraint.constraintsWithVisualFormat("H:|-(hMargin)-[floatLabeledTextField]-(hMargin)-|", options:NSLayoutFormatOptions.AlignAllCenterY, metrics:metrics, views:views)
result += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(vMargin)-[floatLabeledTextField]-(vMargin)-|", options:NSLayoutFormatOptions.AlignAllCenterX, metrics:metrics, views:views)
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)
return result
}
func textFieldDidChange(textField : UITextField) {
if self.floatLabeledTextField == textField {
if self.floatLabeledTextField.text.isEmpty == false {
self.rowDescriptor.value = self.floatLabeledTextField.text
} else {
self.rowDescriptor.value = nil
if floatLabeledTextField == textField {
if let rowDescriptor = rowDescriptor, let text = self.floatLabeledTextField.text {
if text.isEmpty == false {
rowDescriptor.value = self.floatLabeledTextField.text
} else {
rowDescriptor.value = nil
}
}
}
}
@@ -27,20 +27,20 @@ class XLRatingView : AXRatingView {
override init(frame: CGRect) {
super.init(frame: frame)
translatesAutoresizingMaskIntoConstraints = false
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
translatesAutoresizingMaskIntoConstraints = false
}
func customize() {
self.baseColor = UIColor(red: (205/255.0), green: (201/255.0), blue: (201/255.0), alpha: 1)
self.highlightColor = UIColor(red: (255/255.0), green: (215/255.0), blue: 0, alpha: 1)
self.markFont = UIFont.systemFontOfSize(23.0)
self.setTranslatesAutoresizingMaskIntoConstraints(false)
self.stepInterval = 1.0
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)
stepInterval = 1.0
}
}
@@ -25,7 +25,7 @@
let XLFormRowDescriptorTypeRate = "XLFormRowDescriptorTypeRate"
@objc
class XLFormRatingCell : XLFormBaseCell {
@IBOutlet weak var rateTitle: UILabel!
@@ -34,23 +34,23 @@ class XLFormRatingCell : XLFormBaseCell {
override func configure() {
super.configure()
self.selectionStyle = UITableViewCellSelectionStyle.None
self.ratingView.addTarget(self, action: "rateChanged:", forControlEvents:UIControlEvents.ValueChanged)
selectionStyle = .None
ratingView.addTarget(self, action: "rateChanged:", forControlEvents:.ValueChanged)
}
override func update() {
super.update()
self.ratingView.value = self.rowDescriptor.value.floatValue
self.rateTitle.text = self.rowDescriptor.title
self.ratingView.alpha = self.rowDescriptor.isDisabled() ? 0.6 : 1
self.rateTitle.alpha = self.rowDescriptor.isDisabled() ? 0.6 : 1
ratingView.value = rowDescriptor!.value!.floatValue
rateTitle.text = rowDescriptor!.title
ratingView.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
rateTitle.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
}
//MARK: Events
func rateChanged(ratingView : XLRatingView){
self.rowDescriptor.value = ratingView.value
rowDescriptor!.value = ratingView.value
}
}
@@ -1,7 +1,8 @@
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -10,10 +11,12 @@
<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"/>
@@ -22,6 +25,7 @@
</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"/>
@@ -36,6 +40,7 @@
</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"/>
@@ -46,6 +51,7 @@
<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"/>
@@ -81,7 +81,7 @@ class XLFormWeekDaysCell : XLFormBaseCell {
override func configure() {
super.configure()
selectionStyle = UITableViewCellSelectionStyle.None
selectionStyle = .None
configureButtons()
}
@@ -100,18 +100,18 @@ class XLFormWeekDaysCell : XLFormBaseCell {
@IBAction func dayTapped(sender: UIButton) {
let day = getDayFormButton(sender)
sender.selected = !sender.selected
var newValue = rowDescriptor.value as! Dictionary<String, Bool>
var newValue = rowDescriptor!.value as! Dictionary<String, Bool>
newValue[day] = sender.selected
rowDescriptor.value = newValue
rowDescriptor!.value = newValue
}
//MARK: - Helpers
func configureButtons() {
for subview in contentView.subviews {
if let button : UIButton = subview as? UIButton {
button.setImage(UIImage(named: "uncheckedDay"), forState: UIControlState.Normal)
button.setImage(UIImage(named: "checkedDay"), forState: UIControlState.Selected)
if let button = subview as? UIButton {
button.setImage(UIImage(named: "uncheckedDay"), forState: .Normal)
button.setImage(UIImage(named: "checkedDay"), forState: .Selected)
button.adjustsImageWhenHighlighted = false
imageTopTitleBottom(button)
}
@@ -120,17 +120,17 @@ class XLFormWeekDaysCell : XLFormBaseCell {
}
func updateButtons() {
var value = rowDescriptor.value as! Dictionary<String, Bool>
var value = rowDescriptor!.value as! Dictionary<String, Bool>
sundayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Sunday.description()]!
mondayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Monday.description()]!
tuesdayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Tuesday.description()]!
wednesdayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Wednesday.description()]!
thursdayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Thursday.description()]!
fridayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Friday.description()]!
saturdayButton.selected = value[XLFormWeekDaysCell.kWeekDay.Saturday.description()]!
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.alpha = rowDescriptor.isDisabled() ? 0.6 : 1
sundayButton.alpha = rowDescriptor!.isDisabled() ? 0.6 : 1
mondayButton.alpha = mondayButton.alpha
tuesdayButton.alpha = mondayButton.alpha
wednesdayButton.alpha = mondayButton.alpha
@@ -157,19 +157,19 @@ class XLFormWeekDaysCell : XLFormBaseCell {
func getDayFormButton(button: UIButton) -> String {
switch button {
case sundayButton:
return XLFormWeekDaysCell.kWeekDay.Sunday.description()
return kWeekDay.Sunday.description()
case mondayButton:
return XLFormWeekDaysCell.kWeekDay.Monday.description()
return kWeekDay.Monday.description()
case tuesdayButton:
return XLFormWeekDaysCell.kWeekDay.Tuesday.description()
return kWeekDay.Tuesday.description()
case wednesdayButton:
return XLFormWeekDaysCell.kWeekDay.Wednesday.description()
return kWeekDay.Wednesday.description()
case thursdayButton:
return XLFormWeekDaysCell.kWeekDay.Thursday.description()
return kWeekDay.Thursday.description()
case fridayButton:
return XLFormWeekDaysCell.kWeekDay.Friday.description()
return kWeekDay.Friday.description()
default:
return XLFormWeekDaysCell.kWeekDay.Saturday.description()
return kWeekDay.Saturday.description()
}
}
@@ -23,8 +23,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class DateValueTrasformer : NSValueTransformer {
override class func transformedValueClass() -> AnyClass {
@@ -36,22 +34,17 @@ class DateValueTrasformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
if let valueData: AnyObject = value {
if valueData.isKindOfClass(NSDate) {
let date = valueData as! NSDate
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = NSDateFormatterStyle.FullStyle
dateFormatter.timeStyle = NSDateFormatterStyle.NoStyle
return dateFormatter.stringFromDate(date)
}
if let date = value as? NSDate {
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = .FullStyle
dateFormatter.timeStyle = .NoStyle
return dateFormatter.stringFromDate(date)
}
return nil
}
}
class DateTimeValueTrasformer: NSValueTransformer {
override class func transformedValueClass() -> AnyClass {
@@ -64,14 +57,11 @@ class DateTimeValueTrasformer: NSValueTransformer {
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
if let valueData: AnyObject = value {
if valueData.isKindOfClass(NSDate) {
let date = valueData as! NSDate
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
dateFormatter.timeStyle = NSDateFormatterStyle.ShortStyle
return dateFormatter.stringFromDate(date)
}
if let date = value as? NSDate {
let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = .MediumStyle
dateFormatter.timeStyle = .ShortStyle
return dateFormatter.stringFromDate(date)
}
return nil
}
@@ -2,7 +2,7 @@
// DatesFormViewController.swift
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2014 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
@@ -26,42 +26,41 @@
class DatesFormViewController: XLFormViewController {
private enum Tags : String {
case DateInline = "dateInline"
case TimeInline = "timeInline"
case DateTimeInline = "dateTimeInline"
case CountDownTimerInline = "countDownTimerInline"
case DatePicker = "datePicker"
case Date = "date"
case Time = "time"
case DateTime = "dateTime"
case CountDownTimer = "countDownTimer"
private struct Tags {
static let DateInline = "dateInline"
static let TimeInline = "timeInline"
static let DateTimeInline = "dateTimeInline"
static let CountDownTimerInline = "countDownTimerInline"
static let DatePicker = "datePicker"
static let Date = "date"
static let Time = "time"
static let DateTime = "dateTime"
static let CountDownTimer = "countDownTimer"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: UIBarButtonItemStyle.Plain, target: self, action: "disableEnable:")
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
barButton.possibleTitles = Set(["Disable", "Enable"])
self.navigationItem.rightBarButtonItem = barButton
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem)
{
self.form.disabled = !self.form.disabled
button.title = self.form.disabled ? "Enable" : "Disable"
self.tableView.endEditing(true)
self.tableView.reloadData()
func disableEnable(button : UIBarButtonItem){
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
func initializeForm() {
@@ -75,22 +74,22 @@ class DatesFormViewController: XLFormViewController {
form.addFormSection(section)
// Date
row = XLFormRowDescriptor(tag: Tags.DateInline.rawValue, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
row = XLFormRowDescriptor(tag: Tags.DateInline, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
row.value = NSDate()
section.addFormRow(row)
// Time
row = XLFormRowDescriptor(tag: Tags.TimeInline.rawValue, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
row = XLFormRowDescriptor(tag: Tags.TimeInline, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
row.value = NSDate()
section.addFormRow(row)
// DateTime
row = XLFormRowDescriptor(tag: Tags.DateTimeInline.rawValue, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
row = XLFormRowDescriptor(tag: Tags.DateTimeInline, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
row.value = NSDate()
section.addFormRow(row)
// CountDownTimer
row = XLFormRowDescriptor(tag: Tags.CountDownTimerInline.rawValue, rowType:XLFormRowDescriptorTypeCountDownTimerInline, title:"Countdown Timer")
row = XLFormRowDescriptor(tag: Tags.CountDownTimerInline, rowType:XLFormRowDescriptorTypeCountDownTimerInline, title:"Countdown Timer")
row.value = NSDate()
section.addFormRow(row)
@@ -100,25 +99,25 @@ class DatesFormViewController: XLFormViewController {
// Date
row = XLFormRowDescriptor(tag: Tags.Date.rawValue, rowType:XLFormRowDescriptorTypeDate, title:"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)
section.addFormRow(row)
// Time
row = XLFormRowDescriptor(tag: Tags.Time.rawValue, rowType: XLFormRowDescriptorTypeTime, title: "Time")
row = XLFormRowDescriptor(tag: Tags.Time, rowType: XLFormRowDescriptorTypeTime, title: "Time")
row.cellConfigAtConfigure["minuteInterval"] = 10
row.value = NSDate()
section.addFormRow(row)
// DateTime
row = XLFormRowDescriptor(tag: Tags.DateTime.rawValue, rowType: XLFormRowDescriptorTypeDateTime, title: "Date Time")
row = XLFormRowDescriptor(tag: Tags.DateTime, rowType: XLFormRowDescriptorTypeDateTime, title: "Date Time")
row.value = NSDate()
section.addFormRow(row)
// CountDownTimer
row = XLFormRowDescriptor(tag: Tags.CountDownTimer.rawValue, rowType: XLFormRowDescriptorTypeCountDownTimer, title: "Countdown Timer")
row = XLFormRowDescriptor(tag: Tags.CountDownTimer, rowType: XLFormRowDescriptorTypeCountDownTimer, title: "Countdown Timer")
row.value = NSDate()
section.addFormRow(row)
@@ -140,7 +139,7 @@ class DatesFormViewController: XLFormViewController {
form.addFormSection(section)
// DatePicker
row = XLFormRowDescriptor(tag: Tags.DatePicker.rawValue, rowType:XLFormRowDescriptorTypeDatePicker)
row = XLFormRowDescriptor(tag: Tags.DatePicker, rowType:XLFormRowDescriptorTypeDatePicker)
row.cellConfigAtConfigure["datePicker.datePickerMode"] = UIDatePickerMode.Date.rawValue
row.value = NSDate()
section.addFormRow(row)
@@ -154,7 +153,7 @@ class DatesFormViewController: XLFormViewController {
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == Tags.DatePicker.rawValue {
if formRow.tag == Tags.DatePicker {
let alertView = UIAlertView(title: "DatePicker", message: "Value Has changed!", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
@@ -26,29 +26,29 @@
class InputsFormViewController : XLFormViewController {
private enum Tags : String {
case Name = "name"
case Email = "email"
case Twitter = "twitter"
case Number = "number"
case Integer = "integer"
case Decimal = "decimal"
case Password = "password"
case Phone = "phone"
case Url = "url"
case TextView = "textView"
case Notes = "notes"
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)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -66,44 +66,48 @@ class InputsFormViewController : XLFormViewController {
// Name
row = XLFormRowDescriptor(tag: Tags.Name.rawValue, rowType: XLFormRowDescriptorTypeText, title: "Name")
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title: "Name")
row.required = true
section.addFormRow(row)
// Email
row = XLFormRowDescriptor(tag: Tags.Email.rawValue, rowType: XLFormRowDescriptorTypeEmail, title: "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.rawValue, rowType: XLFormRowDescriptorTypeTwitter, title: "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.rawValue, rowType: XLFormRowDescriptorTypeNumber, title: "Number")
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeNumber, title: "Number")
section.addFormRow(row)
// Integer
row = XLFormRowDescriptor(tag: Tags.Integer.rawValue, rowType: XLFormRowDescriptorTypeInteger, title: "Integer")
row = XLFormRowDescriptor(tag: Tags.Integer, rowType: XLFormRowDescriptorTypeInteger, title: "Integer")
section.addFormRow(row)
// Decimal
row = XLFormRowDescriptor(tag: Tags.Decimal.rawValue, rowType: XLFormRowDescriptorTypeDecimal, title: "Decimal")
row = XLFormRowDescriptor(tag: Tags.Decimal, rowType: XLFormRowDescriptorTypeDecimal, title: "Decimal")
section.addFormRow(row)
// Password
row = XLFormRowDescriptor(tag: Tags.Password.rawValue, rowType: XLFormRowDescriptorTypePassword, title: "Password")
row = XLFormRowDescriptor(tag: Tags.Password, rowType: XLFormRowDescriptorTypePassword, title: "Password")
section.addFormRow(row)
// Phone
row = XLFormRowDescriptor(tag: Tags.Phone.rawValue, rowType: XLFormRowDescriptorTypePhone, title: "Phone")
row = XLFormRowDescriptor(tag: Tags.Phone, rowType: XLFormRowDescriptorTypePhone, title: "Phone")
section.addFormRow(row)
// Url
row = XLFormRowDescriptor(tag: Tags.Url.rawValue, rowType: XLFormRowDescriptorTypeURL, title: "Url")
row = XLFormRowDescriptor(tag: Tags.Url, rowType: XLFormRowDescriptorTypeURL, title: "Url")
section.addFormRow(row)
@@ -112,7 +116,7 @@ class InputsFormViewController : XLFormViewController {
// TextView
row = XLFormRowDescriptor(tag: Tags.TextView.rawValue, rowType: XLFormRowDescriptorTypeTextView)
row = XLFormRowDescriptor(tag: Tags.TextView, rowType: XLFormRowDescriptorTypeTextView)
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
section.addFormRow(row)
@@ -120,7 +124,7 @@ class InputsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("TextView With Label Example")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Number.rawValue, rowType: XLFormRowDescriptorTypeTextView, title: "Notes")
row = XLFormRowDescriptor(tag: Tags.Number, rowType: XLFormRowDescriptorTypeTextView, title: "Notes")
section.addFormRow(row)
self.form = form
@@ -130,7 +134,7 @@ class InputsFormViewController : XLFormViewController {
override func viewDidLoad()
{
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Save, target: self, action: "savePressed:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "savePressed:")
}
func savePressed(button: UIBarButtonItem)
@@ -23,27 +23,24 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
class BlogExampleViewController : XLFormViewController {
private enum Tags : String {
case Hobbies = "hobbies"
case Sport = "sport"
case Film = "films1"
case Film2 = "films2"
case Music = "music"
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)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -59,7 +56,7 @@ class BlogExampleViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Hobbies.rawValue, rowType: XLFormRowDescriptorTypeMultipleSelector, title:"Select Hobbies")
row = XLFormRowDescriptor(tag: Tags.Hobbies, rowType: XLFormRowDescriptorTypeMultipleSelector, title:"Select Hobbies")
row.selectorOptions = ["Sport", "Music", "Films"]
row.value = []
section.addFormRow(row)
@@ -70,20 +67,20 @@ class BlogExampleViewController : XLFormViewController {
section.footerTitle = "BlogExampleViewController.swift"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Sport.rawValue, rowType: XLFormRowDescriptorTypeTextView, title:"Your favourite sportsman?")
row.hidden = "NOT $\(Tags.Hobbies.rawValue).value contains 'Sport'"
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.rawValue, rowType:XLFormRowDescriptorTypeTextView, title: "Your favourite film?")
row.hidden = "NOT $\(Tags.Hobbies.rawValue) contains 'Films'"
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.rawValue, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite actor?")
row.hidden = "NOT $\(Tags.Hobbies.rawValue) contains 'Films'"
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.rawValue, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite singer?")
row.hidden = "NOT $\(Tags.Hobbies.rawValue) contains 'Music'"
row = XLFormRowDescriptor(tag: Tags.Music, rowType:XLFormRowDescriptorTypeTextView, title:"Your favourite singer?")
row.hidden = "NOT $\(Tags.Hobbies) contains 'Music'"
section.addFormRow(row)
self.form = form
@@ -26,22 +26,22 @@
class PredicateFormViewController : XLFormViewController {
private enum Tags : String {
case Text = "text"
case Integer = "integer"
case Switch = "switch"
case Date = "date"
case Account = "account"
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)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -56,15 +56,15 @@ class PredicateFormViewController : XLFormViewController {
section.title = "Independent rows"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Text.rawValue, rowType: XLFormRowDescriptorTypeAccount, title:"Text")
row = XLFormRowDescriptor(tag: Tags.Text, rowType: XLFormRowDescriptorTypeAccount, title:"Text")
row.cellConfigAtConfigure["textField.placeholder"] = "Type disable"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Integer.rawValue, rowType: XLFormRowDescriptorTypeInteger, title:"Integer")
row.hidden = NSPredicate(format: "$\(Tags.Switch.rawValue).value==0")
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.rawValue, rowType: XLFormRowDescriptorTypeBooleanSwitch, title:"Boolean")
row = XLFormRowDescriptor(tag: Tags.Switch, rowType: XLFormRowDescriptorTypeBooleanSwitch, title:"Boolean")
row.value = true
section.addFormRow(row)
@@ -76,11 +76,11 @@ class PredicateFormViewController : XLFormViewController {
form.addFormSection(section)
// Predicate Disabling
row = XLFormRowDescriptor(tag: Tags.Date.rawValue, rowType: XLFormRowDescriptorTypeDateInline, title:"Disabled")
row.value = NSDate.new()
row = XLFormRowDescriptor(tag: Tags.Date, rowType: XLFormRowDescriptorTypeDateInline, title:"Disabled")
row.value = NSDate()
section.addFormRow(row)
row.disabled = NSPredicate(format: "$\(Tags.Text.rawValue).value contains[c] 'disable' OR ($\(Tags.Integer.rawValue).value between {18, 60}) OR ($\(Tags.Switch.rawValue).value == 0)")
section.hidden = NSPredicate(format: "($\(Tags.Text.rawValue).value contains[c] 'disable') AND ($\(Tags.Integer.rawValue).value between {18, 60}) AND ($\(Tags.Switch.rawValue).value == 0)")
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)")
@@ -93,20 +93,29 @@ class PredicateFormViewController : XLFormViewController {
row = XLFormRowDescriptor(tag: "thirds", rowType:XLFormRowDescriptorTypeAccount, title:"Account")
section.addFormRow(row)
row.hidden = NSPredicate(format: "$\(Tags.Date.rawValue).isDisabled == 1 AND $\(Tags.Text.rawValue).value contains[c] 'Out'")
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
}
}
@@ -28,7 +28,7 @@ class UserCell : UITableViewCell {
lazy var userImage : UIImageView = {
let tempUserImage = UIImageView()
tempUserImage.setTranslatesAutoresizingMaskIntoConstraints(false)
tempUserImage.translatesAutoresizingMaskIntoConstraints = false
tempUserImage.layer.masksToBounds = true
tempUserImage.layer.cornerRadius = 10.0
return tempUserImage
@@ -37,7 +37,7 @@ class UserCell : UITableViewCell {
lazy var userName : UILabel = {
let tempUserName = UILabel()
tempUserName.setTranslatesAutoresizingMaskIntoConstraints(false)
tempUserName.translatesAutoresizingMaskIntoConstraints = false
tempUserName.font = UIFont.systemFontOfSize(15.0)
return tempUserName
}()
@@ -46,13 +46,12 @@ class UserCell : UITableViewCell {
super.init(style: style, reuseIdentifier: reuseIdentifier)
// Initialization code
self.contentView.addSubview(self.userImage)
self.contentView.addSubview(self.userName)
self.contentView.addConstraints(self.layoutConstraints())
contentView.addSubview(userImage)
contentView.addSubview(userName)
contentView.addConstraints(layoutConstraints())
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@@ -63,12 +62,12 @@ class UserCell : UITableViewCell {
// MARK: - Layout Constraints
func layoutConstraints() -> [AnyObject]{
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:NSLayoutFormatOptions.AlignAllTop, metrics: metrics, views: views)
result += NSLayoutConstraint.constraintsWithVisualFormat("V:|-(margin)-[image(imgSize)]", options:NSLayoutFormatOptions.allZeros, metrics:metrics, views: views)
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
}
@@ -93,7 +92,14 @@ class UsersJSONSerialization {
"{\"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)
return NSJSONSerialization.JSONObjectWithData(jsonData!, options: NSJSONReadingOptions.allZeros, error: nil) as! Array<AnyObject>?
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 {
@@ -115,11 +121,11 @@ class User: NSObject, XLFormOptionObject {
self.userName = userName
}
func formDisplayText() -> String! {
func formDisplayText() -> String {
return self.userName
}
func formValue() -> AnyObject! {
func formValue() -> AnyObject {
return self.userId
}
@@ -140,18 +146,18 @@ class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewC
super.init(style: style);
}
override init!(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerClass(UserCell.self, forCellReuseIdentifier: self.kUserCellIdentifier)
self.tableView.tableFooterView = UIView(frame: CGRect.zeroRect)
tableView.registerClass(UserCell.self, forCellReuseIdentifier: kUserCellIdentifier)
tableView.tableFooterView = UIView(frame: CGRect.zero)
}
// MARK: UITableViewDataSource
@@ -171,8 +177,8 @@ class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewC
let userId = userData["id"] as! Int
cell.userName.text = userData["name"] as? String
cell.userImage.image = UIImage(named: (userData["imageName"] as? String)!)
if self.rowDescriptor?.value != nil {
cell.accessoryType = self.rowDescriptor!.value.formValue().isEqual(userId) ? UITableViewCellAccessoryType.Checkmark : UITableViewCellAccessoryType.None
if let value = rowDescriptor?.value {
cell.accessoryType = value.formValue().isEqual(userId) ? .Checkmark : .None
}
return cell;
@@ -195,8 +201,8 @@ class UsersTableViewController : UITableViewController, XLFormRowDescriptorViewC
porpOver.dismissPopoverAnimated(true)
porpOver.delegate?.popoverControllerDidDismissPopover!(porpOver)
}
else if self.parentViewController is UINavigationController {
self.navigationController?.popViewControllerAnimated(true)
else if parentViewController is UINavigationController {
navigationController?.popViewControllerAnimated(true)
}
}
@@ -93,7 +93,7 @@ NSString * const kValidationInteger = @"kInteger";
// number Section
section = [XLFormSectionDescriptor formSectionWithTitle:@"Validation Numbers"];
section.footerTitle = @"grather than 50 and less than 100";
section.footerTitle = @"greater than 50 and less than 100";
[formDescriptor addFormSection:section];
// Integer
@@ -101,7 +101,7 @@ NSString * const kValidationInteger = @"kInteger";
[row.cellConfigAtConfigure setObject:@"Required..." forKey:@"textField.placeholder"];
[row.cellConfigAtConfigure setObject:@(NSTextAlignmentRight) forKey:@"textField.textAlignment"];
row.required = YES;
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"grather than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
[row addValidator:[XLFormRegexValidator formRegexValidatorWithMsg:@"greater than 50 and less than 100" regex:@"^([5-9][0-9]|100)$"]];
[section addFormRow:row];
self.form = formDescriptor;
@@ -366,7 +366,9 @@
2847A6961AAF2679000A2ABE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0620;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = Xmartlabs;
TargetAttributes = {
2847A69D1AAF2679000A2ABE = {
@@ -497,6 +499,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -511,7 +514,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -548,7 +551,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -564,6 +567,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
};
@@ -577,6 +581,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SwiftExample/SwiftExample-Bridging-Header.h";
};
@@ -28,30 +28,30 @@
class AccessoryViewFormViewController : XLFormViewController {
private enum Tags : String {
case AccessoryViewRowNavigationEnabled = "RowNavigationEnabled"
case AccessoryViewRowNavigationShowAccessoryView = "RowNavigationShowAccessoryView"
case AccessoryViewRowNavigationStopDisableRow = "rowNavigationStopDisableRow"
case AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow = "rowNavigationSkipCanNotBecomeFirstResponderRow"
case AccessoryViewRowNavigationStopInlineRow = "rowNavigationStopInlineRow"
case AccessoryViewName = "name"
case AccessoryViewEmail = "email"
case AccessoryViewTwitter = "twitter"
case AccessoryViewUrl = "url"
case AccessoryViewDate = "date"
case AccessoryViewTextView = "textView"
case AccessoryViewCheck = "check"
case AccessoryViewNotes = "notes"
private struct Tags {
static let AccessoryViewRowNavigationEnabled = "RowNavigationEnabled"
static let AccessoryViewRowNavigationShowAccessoryView = "RowNavigationShowAccessoryView"
static let AccessoryViewRowNavigationStopDisableRow = "rowNavigationStopDisableRow"
static let AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow = "rowNavigationSkipCanNotBecomeFirstResponderRow"
static let AccessoryViewRowNavigationStopInlineRow = "rowNavigationStopInlineRow"
static let AccessoryViewName = "name"
static let AccessoryViewEmail = "email"
static let AccessoryViewTwitter = "twitter"
static let AccessoryViewUrl = "url"
static let AccessoryViewDate = "date"
static let AccessoryViewTextView = "textView"
static let AccessoryViewCheck = "check"
static let AccessoryViewNotes = "notes"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -61,7 +61,7 @@ class AccessoryViewFormViewController : XLFormViewController {
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Accessory View")
form.rowNavigationOptions = XLFormRowNavigationOptions.Enabled
form.rowNavigationOptions = .Enabled
// Configuration section
section = XLFormSectionDescriptor()
@@ -70,65 +70,62 @@ class AccessoryViewFormViewController : XLFormViewController {
form.addFormSection(section)
// RowNavigationEnabled
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationEnabled.rawValue, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Row Navigation Enabled?")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationEnabled, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Row Navigation Enabled?")
row.value = true
section.addFormRow(row)
// RowNavigationShowAccessoryView
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationShowAccessoryView.rawValue, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Show input accessory row?")
row.value = (form.rowNavigationOptions & XLFormRowNavigationOptions.Enabled) == XLFormRowNavigationOptions.Enabled
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled.rawValue) == 0"
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationShowAccessoryView, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Show input accessory row?")
row.value = form.rowNavigationOptions.contains(.Enabled)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationStopDisableRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopDisableRow.rawValue, rowType: XLFormRowDescriptorTypeBooleanCheck, title:"Stop when reach disabled row?")
row.value = (form.rowNavigationOptions & XLFormRowNavigationOptions.StopDisableRow) == XLFormRowNavigationOptions.StopDisableRow
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled.rawValue) == 0"
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopDisableRow, rowType: XLFormRowDescriptorTypeBooleanCheck, title:"Stop when reach disabled row?")
row.value = form.rowNavigationOptions.contains(.StopDisableRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationStopInlineRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopInlineRow.rawValue, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "Stop when reach inline row?")
row.value = (form.rowNavigationOptions & XLFormRowNavigationOptions.StopInlineRow) == XLFormRowNavigationOptions.StopInlineRow
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled.rawValue) == 0"
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationStopInlineRow, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "Stop when reach inline row?")
row.value = form.rowNavigationOptions.contains(.StopInlineRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
// RowNavigationSkipCanNotBecomeFirstResponderRow
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow.rawValue, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Skip Can Not Become First Responder Row?")
row.value = (form.rowNavigationOptions & XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow) == XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled.rawValue) == 0"
row = XLFormRowDescriptor(tag: Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Skip Can Not Become First Responder Row?")
row.value = form.rowNavigationOptions.contains(XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow)
row.hidden = "$\(Tags.AccessoryViewRowNavigationEnabled) == 0"
section.addFormRow(row)
section = XLFormSectionDescriptor()
form.addFormSection(section)
// Name
row = XLFormRowDescriptor(tag: Tags.AccessoryViewName.rawValue, rowType: XLFormRowDescriptorTypeText, title: "Name")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewName, rowType: XLFormRowDescriptorTypeText, title: "Name")
row.required = true
section.addFormRow(row)
// Email
row = XLFormRowDescriptor(tag: Tags.AccessoryViewEmail.rawValue, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewEmail, rowType: XLFormRowDescriptorTypeEmail, title: "Email")
// validate the email
row.addValidator(XLFormValidator.emailValidator())
section.addFormRow(row)
// Twitter
row = XLFormRowDescriptor(tag: Tags.AccessoryViewTwitter.rawValue, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewTwitter, rowType: XLFormRowDescriptorTypeTwitter, title: "Twitter")
row.disabled = NSNumber(bool: true)
row.value = "@no_editable"
section.addFormRow(row)
// Url
row = XLFormRowDescriptor(tag: Tags.AccessoryViewUrl.rawValue, rowType: XLFormRowDescriptorTypeURL, title: "Url")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewUrl, rowType: XLFormRowDescriptorTypeURL, title: "Url")
section.addFormRow(row)
// Date
row = XLFormRowDescriptor(tag: Tags.AccessoryViewDate.rawValue, rowType:XLFormRowDescriptorTypeDateInline, title:"Date Inline")
row.value = NSDate.new()
row = XLFormRowDescriptor(tag: Tags.AccessoryViewDate, rowType:XLFormRowDescriptorTypeDateInline, title:"Date Inline")
row.value = NSDate()
section.addFormRow(row)
@@ -138,17 +135,17 @@ class AccessoryViewFormViewController : XLFormViewController {
row = XLFormRowDescriptor(tag: Tags.AccessoryViewTextView.rawValue, rowType:XLFormRowDescriptorTypeTextView, title: nil)
row = XLFormRowDescriptor(tag: Tags.AccessoryViewTextView, rowType:XLFormRowDescriptorTypeTextView)
row.cellConfigAtConfigure["textView.placeholder"] = "TEXT VIEW EXAMPLE"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.AccessoryViewCheck.rawValue, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Ckeck")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewCheck, rowType:XLFormRowDescriptorTypeBooleanCheck, title:"Check")
section.addFormRow(row)
section = XLFormSectionDescriptor()
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.AccessoryViewNotes.rawValue, rowType:XLFormRowDescriptorTypeTextView, title:"Notes")
row = XLFormRowDescriptor(tag: Tags.AccessoryViewNotes, rowType:XLFormRowDescriptorTypeTextView, title:"Notes")
section.addFormRow(row)
self.form = form
@@ -156,7 +153,7 @@ class AccessoryViewFormViewController : XLFormViewController {
override func inputAccessoryViewForRowDescriptor(rowDescriptor: XLFormRowDescriptor!) -> UIView! {
if self.form.formRowWithTag(Tags.AccessoryViewRowNavigationShowAccessoryView.rawValue)!.value!.boolValue == false {
if form.formRowWithTag(Tags.AccessoryViewRowNavigationShowAccessoryView)!.value!.boolValue == false {
return nil
}
return super.inputAccessoryViewForRowDescriptor(rowDescriptor)
@@ -167,28 +164,32 @@ class AccessoryViewFormViewController : XLFormViewController {
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == Tags.AccessoryViewRowNavigationStopDisableRow.rawValue {
if formRow.value.boolValue == true {
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptions.StopDisableRow
if formRow.tag == Tags.AccessoryViewRowNavigationStopDisableRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.StopDisableRow)
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptions.StopDisableRow)
form.rowNavigationOptions = form.rowNavigationOptions.subtract(.StopDisableRow)
}
}
else if formRow.tag == Tags.AccessoryViewRowNavigationStopInlineRow.rawValue {
if formRow.value.boolValue == true {
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptions.StopInlineRow
else if formRow.tag == Tags.AccessoryViewRowNavigationStopInlineRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.StopInlineRow)
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptions.StopInlineRow)
var options = form.rowNavigationOptions
options = options.subtract(XLFormRowNavigationOptions.StopInlineRow)
form.rowNavigationOptions = options
}
}
else if formRow.tag == Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow.rawValue {
if formRow.value.boolValue == true {
self.form.rowNavigationOptions = self.form.rowNavigationOptions | XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow
else if formRow.tag == Tags.AccessoryViewRowNavigationSkipCanNotBecomeFirstResponderRow {
if formRow.value!.boolValue == true {
form.rowNavigationOptions = form.rowNavigationOptions.union(.SkipCanNotBecomeFirstResponderRow)
}
else{
self.form.rowNavigationOptions = self.form.rowNavigationOptions & (~XLFormRowNavigationOptions.SkipCanNotBecomeFirstResponderRow)
var options = form.rowNavigationOptions
options = options.subtract(.SkipCanNotBecomeFirstResponderRow)
form.rowNavigationOptions = options
}
}
@@ -24,11 +24,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch.
self.window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
// Override point for customization after application launch.
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.backgroundColor = .whiteColor()
// load the initial form form Storybiard
let storyboard = UIStoryboard.init(name:"iPhoneStoryboard", bundle:nil)
self.window!.rootViewController = storyboard.instantiateInitialViewController() as? UIViewController
self.window!.rootViewController = storyboard.instantiateInitialViewController()
self.window!.makeKeyAndVisible()
return true
}
@@ -28,19 +28,19 @@ import MapKit
class CustomSelectorsFormViewController : XLFormViewController {
private enum Tags : String {
case SelectorMap = "selectorMap"
case SelectorMapPopover = "selectorMapPopover"
private struct Tags {
static let SelectorMap = "selectorMap"
static let SelectorMapPopover = "selectorMapPopover"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -56,15 +56,15 @@ class CustomSelectorsFormViewController : XLFormViewController {
form.addFormSection(section)
// Selector Push
row = XLFormRowDescriptor(tag: Tags.SelectorMap.rawValue, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Coordinate")
row = XLFormRowDescriptor(tag: Tags.SelectorMap, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Coordinate")
row.action.viewControllerClass = MapViewController.self
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
// Selector PopOver
row = XLFormRowDescriptor(tag: Tags.SelectorMapPopover.rawValue, rowType: XLFormRowDescriptorTypeSelectorPopover, title: "Coordinate PopOver")
row = XLFormRowDescriptor(tag: Tags.SelectorMapPopover, rowType: XLFormRowDescriptorTypeSelectorPopover, title: "Coordinate PopOver")
row.action.viewControllerClass = MapViewController.self
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
@@ -37,13 +37,10 @@ class CLLocationValueTrasformer : NSValueTransformer {
return false
}
override func transformedValue(value: AnyObject?) -> AnyObject? {
if let valueData: AnyObject = value {
let location = valueData as! CLLocation
if let valueData = value, let location = valueData as? CLLocation{
return String(format: "%0.4f, %0.4f", location.coordinate.latitude, location.coordinate.longitude)
}
return nil
}
}
@@ -23,6 +23,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
import MapKit
class MapAnnotation : NSObject, MKAnnotation {
@@ -30,7 +31,7 @@ class MapAnnotation : NSObject, MKAnnotation {
@objc var coordinate : CLLocationCoordinate2D
override init() {
self.coordinate = CLLocationCoordinate2D(latitude: -33.0, longitude: -56.0)
coordinate = CLLocationCoordinate2D(latitude: -33.0, longitude: -56.0)
super.init()
}
}
@@ -39,43 +40,37 @@ class MapAnnotation : NSObject, MKAnnotation {
class MapViewController : UIViewController, XLFormRowDescriptorViewController, MKMapViewDelegate {
var rowDescriptor: XLFormRowDescriptor?
lazy var mapView : MKMapView = {
lazy var mapView : MKMapView = { [unowned self] in
let mapView = MKMapView(frame: self.view.frame)
mapView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
mapView.autoresizingMask = [UIViewAutoresizing.FlexibleHeight, UIViewAutoresizing.FlexibleWidth]
return mapView
}()
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.addSubview(self.mapView)
self.mapView.delegate = self
if let rowDesc = self.rowDescriptor {
if rowDesc.value != nil {
let coordinate = (self.rowDescriptor!.value as! CLLocation).coordinate
self.mapView.setCenterCoordinate(coordinate, animated: false)
self.title = String(format: "%0.4f, %0.4f", self.mapView.centerCoordinate.latitude, self.mapView.centerCoordinate.longitude)
let annotation = MapAnnotation()
annotation.coordinate = coordinate
self.mapView.addAnnotation(annotation)
}
view.addSubview(mapView)
mapView.delegate = self
if let value = rowDescriptor?.value as? CLLocation {
mapView.setCenterCoordinate(value.coordinate, animated: false)
title = String(format: "%0.4f, %0.4f", mapView.centerCoordinate.latitude, mapView.centerCoordinate.longitude)
let annotation = MapAnnotation()
annotation.coordinate = value.coordinate
self.mapView.addAnnotation(annotation)
}
}
//MARK - - MKMapViewDelegate
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
let pinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
pinAnnotationView.pinColor = MKPinAnnotationColor.Red
@@ -83,12 +78,14 @@ class MapViewController : UIViewController, XLFormRowDescriptorViewController, M
pinAnnotationView.animatesDrop = true
return pinAnnotationView
}
func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, didChangeDragState newState: MKAnnotationViewDragState, fromOldState oldState: MKAnnotationViewDragState) {
if (newState == MKAnnotationViewDragState.Ending){
self.rowDescriptor!.value = CLLocation(latitude:view.annotation.coordinate.latitude, longitude:view.annotation.coordinate.longitude)
self.title = String(format: "%0.4f, %0.4f", view.annotation.coordinate.latitude, view.annotation.coordinate.longitude)
func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, didChangeDragState 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)
}
}
}
@@ -1,7 +1,8 @@
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MapViewController" customModule="SwiftExample" customModuleProvider="target">
@@ -13,6 +14,7 @@
<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"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</objects>
@@ -27,12 +27,12 @@ class DynamicSelectorsFormViewController : XLFormViewController {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -51,7 +51,7 @@ class DynamicSelectorsFormViewController : XLFormViewController {
row.action.viewControllerClass = UsersTableViewController.self
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
// Selector PopOver
row = XLFormRowDescriptor(tag: "selectorUserPopover", rowType:XLFormRowDescriptorTypeSelectorPopover, title:"User Popover")
row.action.viewControllerClass = UsersTableViewController.self
@@ -28,32 +28,32 @@
class ExamplesFormViewController : XLFormViewController {
private enum Tags : String {
case RealExample = "RealExamples"
case TextFieldAndTextView = "TextFieldAndTextView"
case Selectors = "Selectors"
case Othes = "Others"
case Dates = "Dates"
case Predicates = "BasicPredicates"
case BlogExample = "BlogPredicates"
case Multivalued = "Multivalued"
case MultivaluedOnlyReorder = "MultivaluedOnlyReorder"
case MultivaluedOnlyInsert = "MultivaluedOnlyInsert"
case MultivaluedOnlyDelete = "MultivaluedOnlyDelete"
case Validations = "Validations"
case UICusomization = "Customization"
case Custom = "Custom"
case AccessoryView = "Accessory View"
private struct Tags {
static let RealExample = "RealExamples"
static let TextFieldAndTextView = "TextFieldAndTextView"
static let Selectors = "Selectors"
static let Othes = "Others"
static let Dates = "Dates"
static let Predicates = "BasicPredicates"
static let BlogExample = "BlogPredicates"
static let Multivalued = "Multivalued"
static let MultivaluedOnlyReorder = "MultivaluedOnlyReorder"
static let MultivaluedOnlyInsert = "MultivaluedOnlyInsert"
static let MultivaluedOnlyDelete = "MultivaluedOnlyDelete"
static let Validations = "Validations"
static let UICusomization = "Customization"
static let Custom = "Custom"
static let AccessoryView = "Accessory View"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
@@ -70,7 +70,7 @@ class ExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
// NativeEventFormViewController
row = XLFormRowDescriptor(tag: Tags.RealExample.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "iOS Calendar Event Form")
row = XLFormRowDescriptor(tag: Tags.RealExample, rowType: XLFormRowDescriptorTypeButton, title: "iOS Calendar Event Form")
row.action.formSegueIdenfifier = "NativeEventNavigationViewControllerSegue"
section.addFormRow(row)
@@ -80,24 +80,24 @@ class ExamplesFormViewController : XLFormViewController {
// TextFieldAndTextView
row = XLFormRowDescriptor(tag: Tags.TextFieldAndTextView.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Text Fields")
row = XLFormRowDescriptor(tag: Tags.TextFieldAndTextView, rowType: XLFormRowDescriptorTypeButton, title: "Text Fields")
row.action.viewControllerClass = InputsFormViewController.self
section.addFormRow(row)
// Selectors
row = XLFormRowDescriptor(tag: Tags.Selectors.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Selectors")
row = XLFormRowDescriptor(tag: Tags.Selectors, rowType: XLFormRowDescriptorTypeButton, title: "Selectors")
row.action.formSegueIdenfifier = "SelectorsFormViewControllerSegue"
section.addFormRow(row)
// Dates
row = XLFormRowDescriptor(tag: Tags.Dates.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Date & Time")
row = XLFormRowDescriptor(tag: Tags.Dates, rowType: XLFormRowDescriptorTypeButton, title: "Date & Time")
row.action.viewControllerClass = DatesFormViewController.self
section.addFormRow(row)
// Others
row = XLFormRowDescriptor(tag: Tags.Othes.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Other Rows")
row = XLFormRowDescriptor(tag: Tags.Othes, rowType: XLFormRowDescriptorTypeButton, title: "Other Rows")
row.action.formSegueIdenfifier = "OthersFormViewControllerSegue"
section.addFormRow(row)
@@ -106,19 +106,19 @@ class ExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Multivalued.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Sections")
row = XLFormRowDescriptor(tag: Tags.Multivalued, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Sections")
row.action.viewControllerClass = MultivaluedFormViewController.self
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyReorder.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Reorder")
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyReorder, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Reorder")
row.action.viewControllerClass = MultivaluedOnlyReorderViewController.self
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyInsert.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Insert")
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyInsert, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Insert")
row.action.viewControllerClass = MultivaluedOnlyInserViewController.self
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyDelete.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Delete")
row = XLFormRowDescriptor(tag: Tags.MultivaluedOnlyDelete, rowType: XLFormRowDescriptorTypeButton, title: "Multivalued Only Delete")
row.action.viewControllerClass = MultivaluedOnlyDeleteViewController.self
section.addFormRow(row)
@@ -126,7 +126,7 @@ class ExamplesFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("UI Customization")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.UICusomization.rawValue, rowType: XLFormRowDescriptorTypeButton, title:"UI Customization")
row = XLFormRowDescriptor(tag: Tags.UICusomization, rowType: XLFormRowDescriptorTypeButton, title:"UI Customization")
row.action.viewControllerClass = UICustomizationFormViewController.self
section.addFormRow(row)
@@ -134,14 +134,14 @@ class ExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Custom.rawValue, rowType: XLFormRowDescriptorTypeButton, title:"Custom Rows")
row = XLFormRowDescriptor(tag: Tags.Custom, rowType: XLFormRowDescriptorTypeButton, title:"Custom Rows")
row.action.viewControllerClass = CustomRowsViewController.self
section.addFormRow(row)
section = XLFormSectionDescriptor.formSectionWithTitle("Accessory View")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.AccessoryView.rawValue, rowType: XLFormRowDescriptorTypeButton, title:"Accessory Views")
row = XLFormRowDescriptor(tag: Tags.AccessoryView, rowType: XLFormRowDescriptorTypeButton, title:"Accessory Views")
row.action.viewControllerClass = AccessoryViewFormViewController.self
section.addFormRow(row)
@@ -150,7 +150,7 @@ class ExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Validations.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Validation Examples")
row = XLFormRowDescriptor(tag: Tags.Validations, rowType: XLFormRowDescriptorTypeButton, title: "Validation Examples")
row.action.formSegueIdenfifier = "ValidationExamplesFormViewControllerSegue"
section.addFormRow(row)
@@ -158,17 +158,17 @@ class ExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Predicates.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Very basic predicates")
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Very basic predicates")
row.action.formSegueIdenfifier = "BasicPredicateViewControllerSegue"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Predicates.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Blog Example Hide predicates")
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Blog Example Hide predicates")
row.action.formSegueIdenfifier = "BlogExampleViewSegue"
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.Predicates.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Another example")
row = XLFormRowDescriptor(tag: Tags.Predicates, rowType: XLFormRowDescriptorTypeButton, title: "Another example")
row.action.formSegueIdenfifier = "PredicateFormViewControllerSegue"
section.addFormRow(row)
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "default-avatar@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

+3 -3
View File
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.xmartlabs.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>3.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
@@ -25,17 +25,15 @@
class MultivaluedFormViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -47,8 +45,8 @@ class MultivaluedFormViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Examples")
// Multivalued section
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued TextField", sectionOptions:XLFormSectionOptions.CanReorder | XLFormSectionOptions.CanInsert | XLFormSectionOptions.CanDelete, sectionInsertMode:XLFormSectionInsertMode.Button)
section.multivaluedAddButton.title = "Add New Tag"
section = XLFormSectionDescriptor.formSectionWithTitle("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
row = XLFormRowDescriptor(tag: nil, rowType: XLFormRowDescriptorTypeName)
@@ -57,12 +55,8 @@ class MultivaluedFormViewController : XLFormViewController {
form.addFormSection(section)
// Another Multivalued section
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued ActionSheet Selector example", sectionOptions:XLFormSectionOptions.CanInsert | XLFormSectionOptions.CanDelete)
section = XLFormSectionDescriptor.formSectionWithTitle("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..")
@@ -71,12 +65,12 @@ class MultivaluedFormViewController : XLFormViewController {
// Another one
section = XLFormSectionDescriptor.formSectionWithTitle("Multivalued Push Selector example", sectionOptions:XLFormSectionOptions.CanInsert | XLFormSectionOptions.CanDelete | XLFormSectionOptions.CanReorder, sectionInsertMode:XLFormSectionInsertMode.Button)
section = XLFormSectionDescriptor.formSectionWithTitle("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 )..")
row.selectorOptions = ["Option 1", "Option 2", "Option 3"]
section.multivaluedRowTemplate = row.copy() as! XLFormRowDescriptor
section.multivaluedRowTemplate = row.copy() as? XLFormRowDescriptor
section.addFormRow(row)
self.form = form
@@ -84,14 +78,14 @@ class MultivaluedFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Edit, target: self, action: "addDidTouch:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Edit, target: self, action: "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(self.view)
actionSheet.showInView(view)
}
//MARK: - UIActionSheetDelegate
@@ -99,25 +93,25 @@ class MultivaluedFormViewController : XLFormViewController {
override func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
if actionSheet.destructiveButtonIndex == buttonIndex {
if self.form.formSections.count > 0 {
if form.formSections.count > 0 {
// remove last section
self.form.removeFormSectionAtIndex(UInt(self.form.formSections.count - 1))
form.removeFormSectionAtIndex(UInt(form.formSections.count - 1))
}
}
else if actionSheet.buttonTitleAtIndex(buttonIndex) == "Add a section at the end" {
// add a new section
// let dateString = NSDateFormatter.localizedStringFromDate(NSDate.new(), dateStyle: NSDateFormatterStyle.ShortStyle, timeStyle: NSDateFormatterStyle.ShortStyle)
let newSection = XLFormSectionDescriptor.formSectionWithTitle("Section created at \(NSDateFormatter.localizedStringFromDate(NSDate.new(), dateStyle: NSDateFormatterStyle.ShortStyle, timeStyle: NSDateFormatterStyle.ShortStyle))", sectionOptions:XLFormSectionOptions.CanInsert | XLFormSectionOptions.CanDelete)
// 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))
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"]
newSection.addFormRow(newRow)
self.form.addFormSection(newSection)
form.addFormSection(newSection)
}
else {
self.form.disabled = !self.form.disabled
self.tableView.endEditing(true)
self.tableView.reloadData()
form.disabled = !self.form.disabled
tableView.endEditing(true)
tableView.reloadData()
}
}
}
@@ -127,12 +121,11 @@ class MultivaluedFormViewController : XLFormViewController {
class MultivaluedOnlyReorderViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
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()
@@ -151,28 +144,28 @@ class MultivaluedOnlyReorderViewController : XLFormViewController {
// Multivalued Section with inline rows - section set up to support only reordering
section = XLFormSectionDescriptor.formSectionWithTitle("Reordering Inline Rows",
sectionOptions:XLFormSectionOptions.CanReorder)
sectionOptions:.CanReorder)
section.footerTitle = "XLFormRowDescriptorTypeDateInline row type"
form.addFormSection(section)
var idx = 0
for listItem in list {
let timeIntervalSinceNow : NSTimeInterval = NSTimeInterval(secondsPerDay * ++idx)
let timeIntervalSinceNow = NSTimeInterval(secondsPerDay * ++idx)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeDateInline, title: listItem)
row.value = NSDate(timeIntervalSinceNow:timeIntervalSinceNow)
section.addFormRow(row)
}
// Multivalued Section with common rows - section set up to support only reordering
section = XLFormSectionDescriptor.formSectionWithTitle("Reordering Rows", sectionOptions:XLFormSectionOptions.CanReorder)
section = XLFormSectionDescriptor.formSectionWithTitle("Reordering Rows", sectionOptions:.CanReorder)
section.footerTitle = "XLFormRowDescriptorTypeInfo row type"
form.addFormSection(section)
idx = 0
for listItem in list {
let timeIntervalSinceNow : NSTimeInterval = NSTimeInterval(secondsPerDay * ++idx)
let timeIntervalSinceNow = NSTimeInterval(secondsPerDay * ++idx)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeInfo, title: listItem)
row.value = NSDateFormatter.localizedStringFromDate(NSDate(timeIntervalSinceNow:timeIntervalSinceNow), dateStyle: NSDateFormatterStyle.MediumStyle, timeStyle: NSDateFormatterStyle.NoStyle)
row.value = NSDateFormatter.localizedStringFromDate(NSDate(timeIntervalSinceNow:timeIntervalSinceNow), dateStyle: .MediumStyle, timeStyle: .NoStyle)
section.addFormRow(row)
}
@@ -183,7 +176,7 @@ class MultivaluedOnlyReorderViewController : XLFormViewController {
class MultivaluedOnlyInserViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
@@ -204,7 +197,7 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Only Insert")
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton", sectionOptions:XLFormSectionOptions.CanInsert, sectionInsertMode:XLFormSectionInsertMode.Button)
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton", sectionOptions:.CanInsert, sectionInsertMode:.Button)
form.addFormSection(section)
@@ -212,15 +205,15 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
row.cellConfig["textField.placeholder"] = "Add a new tag"
section.multivaluedRowTemplate = row
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton With Inline Cells", sectionOptions:XLFormSectionOptions.CanInsert, sectionInsertMode:XLFormSectionInsertMode.Button)
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeButton With Inline Cells", sectionOptions:.CanInsert, sectionInsertMode:.Button)
row = XLFormRowDescriptor(tag: nil, rowType:XLFormRowDescriptorTypeDateInline)
row.value = NSDate.new()
row.value = NSDate()
row.title = "Date"
section.multivaluedRowTemplate = row
form.addFormSection(section)
section = XLFormSectionDescriptor.formSectionWithTitle("XLFormSectionInsertModeLastRow",
sectionOptions:XLFormSectionOptions.CanInsert, sectionInsertMode:XLFormSectionInsertMode.LastRow)
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,28 +226,26 @@ class MultivaluedOnlyInserViewController : XLFormViewController {
}
}
class MultivaluedOnlyDeleteViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: UIBarButtonItemStyle.Plain, target: self, action: "toggleEditing:")
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Editing", style: .Plain, target: self, action: "toggleEditing:")
}
func toggleEditing(sender : UIBarButtonItem) {
self.tableView.setEditing(!self.tableView.editing, animated: true)
sender.title = self.tableView.editing ? "Editing" : "Not Editing"
tableView.setEditing(!tableView.editing, animated: true)
sender.title = tableView.editing ? "Editing" : "Not Editing"
}
func initializeForm() {
@@ -267,7 +258,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
form = XLFormDescriptor(title: "Multivalued Only Delete")
section = XLFormSectionDescriptor.formSectionWithTitle(nil, sectionOptions:XLFormSectionOptions.CanDelete)
section = XLFormSectionDescriptor.formSectionWithTitle("", sectionOptions:.CanDelete)
section.footerTitle = "you can swipe to delete when table.editing = NO (Not Editing)"
form.addFormSection(section)
@@ -280,7 +271,7 @@ class MultivaluedOnlyDeleteViewController : XLFormViewController {
}
// Multivalued Section with inline row.
section = XLFormSectionDescriptor.formSectionWithTitle(nil, sectionOptions:XLFormSectionOptions.CanDelete)
section = XLFormSectionDescriptor.formSectionWithTitle("", sectionOptions:.CanDelete)
section.footerTitle = "you can swipe to delete when table.editing = NO (Not Editing)"
form.addFormSection(section)
@@ -31,7 +31,7 @@ class XLFormCustomCell : XLFormBaseCell {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
@@ -42,16 +42,26 @@ class XLFormCustomCell : XLFormBaseCell {
override func update() {
super.update()
// override
self.textLabel!.text = self.rowDescriptor.value != nil ? self.rowDescriptor.value as? String : "Am a custom cell, select me!"
if let string = rowDescriptor?.value as? String {
textLabel?.text = string
}
else {
textLabel?.text = "Am a custom cell, select me!"
}
}
override func formDescriptorCellDidSelectedWithFormController(controller: XLFormViewController!) {
// custom code here
// i.e new behaviour when cell has been selected
self.rowDescriptor.value = self.rowDescriptor.value as? String == "I can do any custom behaviour..." ? "Am a custom cell, select me!" : "I can do any custom behaviour..."
self.update()
controller.tableView .selectRowAtIndexPath(nil, animated: true, scrollPosition: UITableViewScrollPosition.None)
if let string = rowDescriptor?.value as? String where string == "Am a custom cell, select me!" {
self.rowDescriptor?.value = string
}
else {
self.rowDescriptor?.value = "I can do any custom behaviour..."
}
update()
controller.tableView.selectRowAtIndexPath(nil, animated: true, scrollPosition: .None)
}
}
@@ -27,23 +27,24 @@ import MapKit
class OthersFormViewController : XLFormViewController {
private enum Tags : String {
case SwitchBool = "switchBool"
case SwitchCheck = "switchCheck"
case StepCounter = "stepCounter"
case Slider = "slider"
case SegmentedControl = "segmentedControl"
case Custom = "custom"
case Info = "info"
case Button = "button"
case ButtonLeftAligned = "buttonLeftAligned"
case ButtonWithSegueId = "buttonWithSegueId"
case ButtonWithSegueClass = "buttonWithSegueClass"
case ButtonWithNibName = "buttonWithNibName"
case ButtonWithStoryboardId = "buttonWithStoryboardId"
private struct Tags {
static let SwitchBool = "switchBool"
static let SwitchCheck = "switchCheck"
static let StepCounter = "stepCounter"
static let Slider = "slider"
static let SegmentedControl = "segmentedControl"
static let Custom = "custom"
static let Info = "info"
static let Button = "button"
static let Image = "image"
static let ButtonLeftAligned = "buttonLeftAligned"
static let ButtonWithSegueId = "buttonWithSegueId"
static let ButtonWithSegueClass = "buttonWithSegueClass"
static let ButtonWithNibName = "buttonWithNibName"
static let ButtonWithStoryboardId = "buttonWithStoryboardId"
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
@@ -67,32 +68,36 @@ class OthersFormViewController : XLFormViewController {
form.addFormSection(section)
// Switch
section.addFormRow(XLFormRowDescriptor(tag: Tags.SwitchBool.rawValue, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Switch"))
section.addFormRow(XLFormRowDescriptor(tag: Tags.SwitchBool, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Switch"))
// Check
section.addFormRow(XLFormRowDescriptor(tag: Tags.SwitchCheck.rawValue, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "Check"))
section.addFormRow(XLFormRowDescriptor(tag: Tags.SwitchCheck, rowType: XLFormRowDescriptorTypeBooleanCheck, title: "Check"))
// Step counter
section.addFormRow(XLFormRowDescriptor(tag: Tags.StepCounter.rawValue, rowType: XLFormRowDescriptorTypeStepCounter, title: "Step counter"))
section.addFormRow(XLFormRowDescriptor(tag: Tags.StepCounter, rowType: XLFormRowDescriptorTypeStepCounter, title: "Step counter"))
// Segmented Control
row = XLFormRowDescriptor(tag: Tags.SegmentedControl.rawValue, rowType: XLFormRowDescriptorTypeSelectorSegmentedControl, title: "Fruits")
row = XLFormRowDescriptor(tag: Tags.SegmentedControl, rowType: XLFormRowDescriptorTypeSelectorSegmentedControl, title: "Fruits")
row.selectorOptions = ["Apple", "Orange", "Pear"]
row.value = "Pear"
section.addFormRow(row)
// Slider
row = XLFormRowDescriptor(tag: Tags.Slider.rawValue, rowType: XLFormRowDescriptorTypeSlider, title: "Slider")
row = XLFormRowDescriptor(tag: Tags.Slider, rowType: XLFormRowDescriptorTypeSlider, title: "Slider")
row.value = 30
row.cellConfigAtConfigure["slider.maximumValue"] = 100
row.cellConfigAtConfigure["slider.minimumValue"] = 10
row.cellConfigAtConfigure["steps"] = 4
section.addFormRow(row)
// Image
row = XLFormRowDescriptor(tag: Tags.Image, rowType: XLFormRowDescriptorTypeImage, title: "Image")
row.value = UIImage(named: "default_avatar")
section.addFormRow(row)
// Info cell
row = XLFormRowDescriptor(tag: Tags.Info.rawValue, rowType: XLFormRowDescriptorTypeInfo)
row = XLFormRowDescriptor(tag: Tags.Info, rowType: XLFormRowDescriptorTypeInfo)
row.title = "Version"
row.value = NSBundle.mainBundle().infoDictionary!["CFBundleShortVersionString"]
section.addFormRow(row)
@@ -103,30 +108,30 @@ class OthersFormViewController : XLFormViewController {
form.addFormSection(section)
// Button
row = XLFormRowDescriptor(tag: Tags.Button.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "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:"
section.addFormRow(row)
// Left Button
row = XLFormRowDescriptor(tag: Tags.ButtonLeftAligned.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Button with Block")
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.action.formBlock = { (sender: XLFormRowDescriptor!) -> Void in
let switchRow = sender.sectionDescriptor.formDescriptor.formRowWithTag(Tags.SwitchBool.rawValue)
if switchRow.value != nil && switchRow.value!.boolValue == true {
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 alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
self.deselectFormRow(sender)
self?.deselectFormRow(sender)
}
section.addFormRow(row)
// Another Left Button with segue
row = XLFormRowDescriptor(tag: Tags.ButtonWithSegueClass.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Button with Segue Class")
row = XLFormRowDescriptor(tag: Tags.ButtonWithSegueClass, rowType: XLFormRowDescriptorTypeButton, title: "Button with Segue Class")
row.action.formSegueClass = NSClassFromString("UIStoryboardPushSegue")
row.action.viewControllerClass = MapViewController.self
row.value = CLLocation(latitude: -33.0, longitude: -56.0)
@@ -134,20 +139,20 @@ class OthersFormViewController : XLFormViewController {
// Button with SegueId
row = XLFormRowDescriptor(tag: Tags.ButtonWithSegueId.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Button with Segue Idenfifier")
row = XLFormRowDescriptor(tag: Tags.ButtonWithSegueId, rowType: XLFormRowDescriptorTypeButton, title: "Button with Segue Idenfifier")
row.action.formSegueIdenfifier = "MapViewControllerSegue"
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
// Another Button using StoryboardId
row = XLFormRowDescriptor(tag: Tags.ButtonWithStoryboardId.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Button with StoryboardId")
row = XLFormRowDescriptor(tag: Tags.ButtonWithStoryboardId, rowType: XLFormRowDescriptorTypeButton, title: "Button with StoryboardId")
row.action.viewControllerStoryboardId = "MapViewController"
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
// Button using NibName
row = XLFormRowDescriptor(tag: Tags.ButtonWithNibName.rawValue, rowType: XLFormRowDescriptorTypeButton, title: "Button with NibName")
row = XLFormRowDescriptor(tag: Tags.ButtonWithNibName, rowType: XLFormRowDescriptorTypeButton, title: "Button with NibName")
row.action.viewControllerNibName = "MapViewController"
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
@@ -157,7 +162,7 @@ class OthersFormViewController : XLFormViewController {
func didTouchButton(sender: XLFormRowDescriptor) {
if sender.sectionDescriptor.formDescriptor.formRowWithTag(Tags.SwitchBool.rawValue).value.boolValue == true{
if sender.sectionDescriptor.formDescriptor.formRowWithTag(Tags.SwitchBool)?.value?.boolValue == true{
let alertView = UIAlertView(title: "Switch is ON", message: "Button has checked the switch value...", delegate: self, cancelButtonTitle: "OK")
alertView.show()
}
@@ -166,18 +171,17 @@ class OthersFormViewController : XLFormViewController {
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: UIBarButtonItemStyle.Plain, target: self, action: "disableEnable:")
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
barButton.possibleTitles = Set(["Disable", "Enable"])
self.navigationItem.rightBarButtonItem = barButton
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem)
{
self.form.disabled = !self.form.disabled
button.title = self.form.disabled ? "Enable" : "Disable"
self.tableView.endEditing(true)
self.tableView.reloadData()
func disableEnable(button : UIBarButtonItem) {
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
}
@@ -26,22 +26,23 @@
class BasicPredicateViewController : XLFormViewController {
private enum Tags : String {
private struct Tags {
case HideRow = "tag1"
case HideSection = "tag2"
case Text = "tag3"
static let HideRow = "tag1"
static let HideSection = "tag2"
static let Text = "tag3"
static let Date = "tag4"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -51,33 +52,33 @@ class BasicPredicateViewController : XLFormViewController {
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Basic Predicates")
self.form = form
section = XLFormSectionDescriptor()
section.title = "A Section"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.HideRow.rawValue, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Show next row")
row.value = 0
row = XLFormRowDescriptor(tag: Tags.HideRow, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Show next row")
row.value = 1
section.addFormRow(row)
row = XLFormRowDescriptor(tag: Tags.HideSection.rawValue, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Show B Section")
row.hidden = "$\(Tags.HideRow.rawValue)==0"
row.value = 0
row = XLFormRowDescriptor(tag: Tags.HideSection, rowType: XLFormRowDescriptorTypeBooleanSwitch, title: "Show B Section")
row.hidden = "$\(Tags.HideRow)==0"
row.value = 1
section.addFormRow(row)
section = XLFormSectionDescriptor()
section.title = "B Section"
section.footerTitle = "BasicPredicateViewController.swift"
section.hidden = "$\(Tags.HideSection.rawValue)==0"
section.hidden = "$\(Tags.HideSection)==0"
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Text.rawValue, rowType: XLFormRowDescriptorTypeText, title:nil)
row = XLFormRowDescriptor(tag: Tags.Text, rowType: XLFormRowDescriptorTypeText)
row.cellConfigAtConfigure["textField.placeholder"] = "Gonna disappear soon!!"
section.addFormRow(row)
self.form = form
row = XLFormRowDescriptor(tag: Tags.Date, rowType: XLFormRowDescriptorTypeDateInline, title: "Some Date")
row.hidden = "$\(Tags.Text).value contains 'aaa'"
section.addFormRow(row)
}
}
@@ -26,26 +26,22 @@
class NativeEventFormViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
func initializeForm() {
let form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Add Event")
section = XLFormSectionDescriptor.formSection()
@@ -141,11 +137,10 @@ class NativeEventFormViewController : XLFormViewController {
self.form = form
}
override func viewDidLoad()
{
override func viewDidLoad(){
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Cancel, target: self, action: "cancelPressed:")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Save, target: self, action: "savePressed:")
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: "cancelPressed:")
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Save, target: self, action: "savePressed:")
}
// MARK: XLFormDescriptorDelegate
@@ -153,84 +148,80 @@ class NativeEventFormViewController : XLFormViewController {
override func formRowDescriptorValueHasChanged(formRow: XLFormRowDescriptor!, oldValue: AnyObject!, newValue: AnyObject!) {
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
if formRow.tag == "alert" {
if !formRow.value.valueData().isEqual(0) && oldValue.valueData().isEqual(0) {
if !formRow.value!.valueData().isEqual(0) && oldValue.valueData().isEqual(0) {
let newRow = formRow.copy() as! XLFormRowDescriptor
newRow.tag = "secondAlert"
newRow.title = "Second Alert"
self.form.addFormRow(newRow, afterRow:formRow)
form.addFormRow(newRow, afterRow:formRow)
}
else if !oldValue.valueData().isEqual(0) && newValue.valueData().isEqual(0) {
self.form.removeFormRowWithTag("secondAlert")
form.removeFormRowWithTag("secondAlert")
}
}
else if formRow.tag == "all-day" {
let startDateDescriptor = self.form.formRowWithTag("starts")
let endDateDescriptor = self.form.formRowWithTag("ends")
let dateStartCell: XLFormDateCell = self.form.formRowWithTag("starts").cellForFormController(self) as! XLFormDateCell
let dateEndCell: XLFormDateCell = self.form.formRowWithTag("ends").cellForFormController(self) as! XLFormDateCell
if formRow.value.valueData() as? Bool == true {
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 {
startDateDescriptor.valueTransformer = DateValueTrasformer.self
endDateDescriptor.valueTransformer = DateValueTrasformer.self
dateStartCell.formDatePickerMode = XLFormDateDatePickerMode.Date
dateEndCell.formDatePickerMode = XLFormDateDatePickerMode.Date
dateStartCell.formDatePickerMode = .Date
dateEndCell.formDatePickerMode = .Date
}
else{
startDateDescriptor.valueTransformer = DateTimeValueTrasformer.self
endDateDescriptor.valueTransformer = DateTimeValueTrasformer.self
dateStartCell.formDatePickerMode = XLFormDateDatePickerMode.DateTime
dateEndCell.formDatePickerMode = XLFormDateDatePickerMode.DateTime
dateStartCell.formDatePickerMode = .DateTime
dateEndCell.formDatePickerMode = .DateTime
}
self.updateFormRow(startDateDescriptor)
self.updateFormRow(endDateDescriptor)
updateFormRow(startDateDescriptor)
updateFormRow(endDateDescriptor)
}
else if formRow.tag == "starts" {
let startDateDescriptor = self.form.formRowWithTag("starts")
let endDateDescriptor = self.form.formRowWithTag("ends")
let dateStartCell: XLFormDateCell = self.form.formRowWithTag("starts").cellForFormController(self) as! XLFormDateCell
let dateEndCell: XLFormDateCell = self.form.formRowWithTag("ends").cellForFormController(self) as! XLFormDateCell
if startDateDescriptor.value.compare(endDateDescriptor.value as! NSDate) == NSComparisonResult.OrderedDescending {
let startDateDescriptor = form.formRowWithTag("starts")!
let endDateDescriptor = form.formRowWithTag("ends")!
if startDateDescriptor.value!.compare(endDateDescriptor.value as! NSDate) == .OrderedDescending {
// startDateDescriptor is later than endDateDescriptor
endDateDescriptor.value = NSDate(timeInterval: 60*60*24, sinceDate: startDateDescriptor.value as! NSDate)
endDateDescriptor.cellConfig.removeObjectForKey("detailTextLabel.attributedText")
self.updateFormRow(endDateDescriptor)
updateFormRow(endDateDescriptor)
}
}
else if formRow.tag == "ends" {
let startDateDescriptor = self.form.formRowWithTag("starts")
let endDateDescriptor = self.form.formRowWithTag("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) == NSComparisonResult.OrderedDescending {
if startDateDescriptor.value!.compare(endDateDescriptor.value as! NSDate) == .OrderedDescending {
// startDateDescriptor is later than endDateDescriptor
dateEndCell.update()
let newDetailText : String = dateEndCell.detailTextLabel!.text!
let newDetailText = dateEndCell.detailTextLabel!.text!
let strikeThroughAttribute = [NSStrikethroughStyleAttributeName : NSUnderlineStyle.StyleSingle.rawValue]
let strikeThroughText = NSAttributedString(string: newDetailText, attributes: strikeThroughAttribute)
endDateDescriptor.cellConfig["detailTextLabel.attributedText"] = strikeThroughText
self.updateFormRow(endDateDescriptor)
updateFormRow(endDateDescriptor)
}
else{
let endDateDescriptor = self.form.formRowWithTag("ends")
let endDateDescriptor = self.form.formRowWithTag("ends")!
endDateDescriptor.cellConfig.removeObjectForKey("detailTextLabel.attributedText")
self.updateFormRow(endDateDescriptor)
updateFormRow(endDateDescriptor)
}
}
}
func cancelPressed(button: UIBarButtonItem)
{
self.dismissViewControllerAnimated(true, completion: nil)
func cancelPressed(button: UIBarButtonItem){
dismissViewControllerAnimated(true, completion: nil)
}
func savePressed(button: UIBarButtonItem)
{
let validationErrors : Array<NSError> = self.formValidationErrors() as! Array<NSError>
func savePressed(button: UIBarButtonItem){
let validationErrors : Array<NSError> = formValidationErrors() as! Array<NSError>
if (validationErrors.count > 0){
self.showFormValidationError(validationErrors.first)
showFormValidationError(validationErrors.first)
return
}
self.tableView.endEditing(true)
tableView.endEditing(true)
}
}
@@ -239,7 +230,7 @@ class NativeEventNavigationViewController : UINavigationController {
override func viewDidLoad(){
super.viewDidLoad()
self.view.tintColor = UIColor.redColor()
view.tintColor = .redColor()
}
}
@@ -33,7 +33,6 @@ class NSArrayValueTrasformer : NSValueTransformer {
return NSString.self
}
override class func allowsReverseTransformation() -> Bool {
return false
}
@@ -72,48 +71,48 @@ class ISOLanguageCodesValueTranformer : NSValueTransformer {
class SelectorsFormViewController : XLFormViewController {
private enum Tags : String {
case Push = "selectorPush"
case Popover = "selectorPopover"
case ActionSheet = "selectorActionSheet"
case AlertView = "selectorAlertView"
case PickerView = "selectorPickerView"
case Picker = "selectorPicker"
case PickerViewInline = "selectorPickerViewInline"
case MultipleSelector = "multipleSelector"
case MultipleSelectorPopover = "multipleSelectorPopover"
case DynamicSelectors = "dynamicSelectors"
case CustomSelectors = "customSelectors"
case SelectorWithSegueId = "selectorWithSegueId"
case SelectorWithSegueClass = "selectorWithSegueClass"
case SelectorWithNibName = "selectorWithNibName"
case SelectorWithStoryboardId = "selectorWithStoryboardId"
private struct Tags {
static let Push = "selectorPush"
static let Popover = "selectorPopover"
static let ActionSheet = "selectorActionSheet"
static let AlertView = "selectorAlertView"
static let PickerView = "selectorPickerView"
static let Picker = "selectorPicker"
static let PickerViewInline = "selectorPickerViewInline"
static let MultipleSelector = "multipleSelector"
static let MultipleSelectorPopover = "multipleSelectorPopover"
static let DynamicSelectors = "dynamicSelectors"
static let CustomSelectors = "customSelectors"
static let SelectorWithSegueId = "selectorWithSegueId"
static let SelectorWithSegueClass = "selectorWithSegueClass"
static let SelectorWithNibName = "selectorWithNibName"
static let SelectorWithStoryboardId = "selectorWithStoryboardId"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
override func viewDidLoad() {
super.viewDidLoad()
let barButton = UIBarButtonItem(title: "Disable", style: UIBarButtonItemStyle.Plain, target: self, action: "disableEnable:")
let barButton = UIBarButtonItem(title: "Disable", style: .Plain, target: self, action: "disableEnable:")
barButton.possibleTitles = Set(["Disable", "Enable"])
self.navigationItem.rightBarButtonItem = barButton
navigationItem.rightBarButtonItem = barButton
}
func disableEnable(button : UIBarButtonItem)
{
self.form.disabled = !self.form.disabled
button.title = self.form.disabled ? "Enable" : "Disable"
self.tableView.endEditing(true)
self.tableView.reloadData()
form.disabled = !form.disabled
button.title = form.disabled ? "Enable" : "Disable"
tableView.endEditing(true)
tableView.reloadData()
}
func initializeForm() {
@@ -129,7 +128,7 @@ class SelectorsFormViewController : XLFormViewController {
// Selector Push
row = XLFormRowDescriptor(tag: Tags.Push.rawValue, rowType:XLFormRowDescriptorTypeSelectorPush, title:"Push")
row = XLFormRowDescriptor(tag: Tags.Push, rowType:XLFormRowDescriptorTypeSelectorPush, title:"Push")
row.selectorOptions = [XLFormOptionsObject(value: 0, displayText: "Option 1"),
XLFormOptionsObject(value: 1, displayText:"Option 2"),
XLFormOptionsObject(value: 2, displayText:"Option 3"),
@@ -142,14 +141,14 @@ class SelectorsFormViewController : XLFormViewController {
// Selector Popover
if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad){
row = XLFormRowDescriptor(tag: Tags.Popover.rawValue, rowType:XLFormRowDescriptorTypeSelectorPopover, title:"PopOver")
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"
section.addFormRow(row)
}
// Selector Action Sheet
row = XLFormRowDescriptor(tag :Tags.ActionSheet.rawValue, rowType:XLFormRowDescriptorTypeSelectorActionSheet, title:"Sheet")
row = XLFormRowDescriptor(tag :Tags.ActionSheet, rowType:XLFormRowDescriptorTypeSelectorActionSheet, title:"Sheet")
row.selectorOptions = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]
row.value = "Option 3"
section.addFormRow(row)
@@ -157,13 +156,13 @@ class SelectorsFormViewController : XLFormViewController {
// Selector Alert View
row = XLFormRowDescriptor(tag: Tags.AlertView.rawValue, rowType:XLFormRowDescriptorTypeSelectorAlertView, title:"Alert View")
row = XLFormRowDescriptor(tag: Tags.AlertView, rowType:XLFormRowDescriptorTypeSelectorAlertView, title:"Alert View")
row.selectorOptions = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]
row.value = "Option 3"
section.addFormRow(row)
// Selector Picker View
row = XLFormRowDescriptor(tag: Tags.PickerView.rawValue, rowType:XLFormRowDescriptorTypeSelectorPickerView, title:"Picker View")
row = XLFormRowDescriptor(tag: Tags.PickerView, rowType:XLFormRowDescriptorTypeSelectorPickerView, title:"Picker View")
row.selectorOptions = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]
row.value = "Option 4"
section.addFormRow(row)
@@ -173,7 +172,7 @@ class SelectorsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Fixed Controls")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.Picker.rawValue, rowType:XLFormRowDescriptorTypePicker)
row = XLFormRowDescriptor(tag: Tags.Picker, rowType:XLFormRowDescriptorTypePicker)
row.selectorOptions = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]
row.value = "Option 1"
section.addFormRow(row)
@@ -182,7 +181,7 @@ class SelectorsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.MultipleSelector.rawValue, rowType:XLFormRowDescriptorTypeSelectorPickerViewInline, title:"Inline Picker View")
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, 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)
@@ -191,14 +190,14 @@ class SelectorsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Multiple Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.MultipleSelector.rawValue, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, 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(tag: Tags.MultipleSelector.rawValue, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, 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.self
@@ -206,7 +205,7 @@ class SelectorsFormViewController : XLFormViewController {
// Language multiple selector
row = XLFormRowDescriptor(tag: Tags.MultipleSelector.rawValue, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
row = XLFormRowDescriptor(tag: Tags.MultipleSelector, rowType:XLFormRowDescriptorTypeMultipleSelector, title:"Multiple Selector")
row.selectorOptions = NSLocale.ISOLanguageCodes()
row.selectorTitle = "Languages"
row.valueTransformer = ISOLanguageCodesValueTranformer.self
@@ -214,9 +213,9 @@ class SelectorsFormViewController : XLFormViewController {
section.addFormRow(row)
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
// Language multiple selector popover
row = XLFormRowDescriptor(tag: Tags.MultipleSelectorPopover.rawValue, rowType:XLFormRowDescriptorTypeMultipleSelectorPopover, title:"Multiple Selector PopOver")
row = XLFormRowDescriptor(tag: Tags.MultipleSelectorPopover, rowType:XLFormRowDescriptorTypeMultipleSelectorPopover, title:"Multiple Selector PopOver")
row.selectorOptions = NSLocale.ISOLanguageCodes()
row.valueTransformer = ISOLanguageCodesValueTranformer.self
row.value = NSLocale.preferredLanguages()
@@ -229,7 +228,7 @@ class SelectorsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Dynamic Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.DynamicSelectors.rawValue, rowType:XLFormRowDescriptorTypeButton, title:"Dynamic Selectors")
row = XLFormRowDescriptor(tag: Tags.DynamicSelectors, rowType:XLFormRowDescriptorTypeButton, title:"Dynamic Selectors")
row.action.viewControllerClass = DynamicSelectorsFormViewController.self
section.addFormRow(row)
@@ -239,7 +238,7 @@ class SelectorsFormViewController : XLFormViewController {
section = XLFormSectionDescriptor.formSectionWithTitle("Custom Selectors")
form.addFormSection(section)
row = XLFormRowDescriptor(tag: Tags.CustomSelectors.rawValue, rowType:XLFormRowDescriptorTypeButton, title:"Custom Selectors")
row = XLFormRowDescriptor(tag: Tags.CustomSelectors, rowType:XLFormRowDescriptorTypeButton, title:"Custom Selectors")
row.action.viewControllerClass = CustomSelectorsFormViewController.self
section.addFormRow(row)
@@ -249,7 +248,7 @@ class SelectorsFormViewController : XLFormViewController {
form.addFormSection(section)
// selector with segue class
row = XLFormRowDescriptor(tag: Tags.SelectorWithSegueClass.rawValue, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with Segue Class")
row = XLFormRowDescriptor(tag: Tags.SelectorWithSegueClass, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with Segue Class")
row.action.formSegueClass = NSClassFromString("UIStoryboardPushSegue")
row.action.viewControllerClass = MapViewController.self
row.valueTransformer = CLLocationValueTrasformer.self
@@ -257,21 +256,21 @@ class SelectorsFormViewController : XLFormViewController {
section.addFormRow(row)
// selector with SegueId
row = XLFormRowDescriptor(tag: Tags.SelectorWithSegueId.rawValue, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with Segue Idenfifier")
row = XLFormRowDescriptor(tag: Tags.SelectorWithSegueId, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with Segue Idenfifier")
row.action.formSegueIdenfifier = "MapViewControllerSegue";
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
// selector using StoryboardId
row = XLFormRowDescriptor(tag: Tags.SelectorWithStoryboardId.rawValue, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with StoryboardId")
row = XLFormRowDescriptor(tag: Tags.SelectorWithStoryboardId, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with StoryboardId")
row.action.viewControllerStoryboardId = "MapViewController";
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
section.addFormRow(row)
// selector with NibName
row = XLFormRowDescriptor(tag: Tags.SelectorWithNibName.rawValue, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with NibName")
row = XLFormRowDescriptor(tag: Tags.SelectorWithNibName, rowType: XLFormRowDescriptorTypeSelectorPush, title: "Selector with NibName")
row.action.viewControllerNibName = "MapViewController"
row.valueTransformer = CLLocationValueTrasformer.self
row.value = CLLocation(latitude: -33, longitude: -56)
@@ -25,9 +25,9 @@
class UICustomizationFormViewController : XLFormViewController {
private enum Tags : String {
case Name = "Name"
case Button = "Button"
private struct Tags {
static let Name = "Name"
static let Button = "Button"
}
@@ -36,7 +36,7 @@ class UICustomizationFormViewController : XLFormViewController {
self.initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
@@ -53,7 +53,7 @@ class UICustomizationFormViewController : XLFormViewController {
form.addFormSection(section)
// Name
row = XLFormRowDescriptor(tag: Tags.Name.rawValue, rowType: XLFormRowDescriptorTypeText, title:"Name")
row = XLFormRowDescriptor(tag: Tags.Name, rowType: XLFormRowDescriptorTypeText, title:"Name")
// change the background color
row.cellConfigAtConfigure["backgroundColor"] = UIColor.greenColor()
// font
@@ -72,7 +72,7 @@ class UICustomizationFormViewController : XLFormViewController {
form.addFormSection(section)
//Button
row = XLFormRowDescriptor(tag: Tags.Button.rawValue, rowType: XLFormRowDescriptorTypeButton, title:"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)
@@ -83,10 +83,10 @@ class UICustomizationFormViewController : XLFormViewController {
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// change cell height of a particular cell
if self.form.formRowAtIndex(indexPath)?.tag == "Name" {
if form.formRowAtIndex(indexPath)?.tag == "Name" {
return 60.0
}
else if self.form.formRowAtIndex(indexPath)?.tag == "Button" {
else if form.formRowAtIndex(indexPath)?.tag == "Button" {
return 100.0
}
return super.tableView(tableView, heightForRowAtIndexPath: indexPath)
@@ -26,22 +26,22 @@
class ValidationExamplesFormViewController : XLFormViewController {
private enum Tags : String {
case ValidationName = "Name"
case ValidationEmail = "Email"
case ValidationPassword = "Password"
case ValidationInteger = "Integer"
private struct Tags {
static let ValidationName = "Name"
static let ValidationEmail = "Email"
static let ValidationPassword = "Password"
static let ValidationInteger = "Integer"
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
initializeForm()
}
required init(coder aDecoder: NSCoder) {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
initializeForm()
}
func initializeForm() {
@@ -58,7 +58,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
// Name
row = XLFormRowDescriptor(tag: Tags.ValidationName.rawValue, rowType: XLFormRowDescriptorTypeText, title:"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
@@ -70,7 +70,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
// Email
row = XLFormRowDescriptor(tag: Tags.ValidationEmail.rawValue, rowType: XLFormRowDescriptorTypeText, title:"Email")
row = XLFormRowDescriptor(tag: Tags.ValidationEmail, rowType: XLFormRowDescriptorTypeText, title:"Email")
row.cellConfigAtConfigure["textField.textAlignment"] = NSTextAlignment.Right.rawValue
row.required = false
row.value = "not valid email"
@@ -84,7 +84,7 @@ class ValidationExamplesFormViewController : XLFormViewController {
form.addFormSection(section)
// Password
row = XLFormRowDescriptor(tag: Tags.ValidationPassword.rawValue, rowType: XLFormRowDescriptorTypePassword, title:"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
@@ -94,26 +94,24 @@ class ValidationExamplesFormViewController : XLFormViewController {
section = XLFormSectionDescriptor()
section.title = "Validation Numbers"
section.footerTitle = "grather than 50 and less than 100"
section.footerTitle = "greater than 50 and less than 100"
form.addFormSection(section)
// Integer
row = XLFormRowDescriptor(tag: Tags.ValidationInteger.rawValue, rowType:XLFormRowDescriptorTypeInteger, title:"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.addValidator(XLFormRegexValidator(msg: "grather than 50 and less than 100", andRegexString: "^([5-9][0-9]|100)$"))
row.addValidator(XLFormRegexValidator(msg: "greater than 50 and less than 100", andRegexString: "^([5-9][0-9]|100)$"))
section.addFormRow(row)
self.form = form
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.rightBarButtonItem?.target = self
self.navigationItem.rightBarButtonItem?.action = "validateForm:"
navigationItem.rightBarButtonItem?.target = self
navigationItem.rightBarButtonItem?.action = "validateForm:"
}
@@ -121,22 +119,22 @@ class ValidationExamplesFormViewController : XLFormViewController {
//MARK: Actions
func validateForm(buttonItem: UIBarButtonItem) {
let array = self.formValidationErrors()
let array = formValidationErrors()
for errorItem in array {
let error = errorItem as! NSError
let validationStatus : XLFormValidationStatus = error.userInfo![XLValidationStatusErrorKey] as! XLFormValidationStatus
if validationStatus.rowDescriptor.tag == Tags.ValidationName.rawValue {
if let cell = self.tableView.cellForRowAtIndexPath(self.form.indexPathOfFormRow(validationStatus.rowDescriptor)) {
cell.backgroundColor = UIColor.orangeColor()
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 = UIColor.whiteColor()
cell.backgroundColor = .whiteColor()
})
}
}
else if validationStatus.rowDescriptor.tag == Tags.ValidationEmail.rawValue ||
validationStatus.rowDescriptor.tag == Tags.ValidationPassword.rawValue ||
validationStatus.rowDescriptor.tag == Tags.ValidationInteger.rawValue {
if let cell = self.tableView.cellForRowAtIndexPath(self.form.indexPathOfFormRow(validationStatus.rowDescriptor)) {
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) {
self.animateCell(cell)
}
}
+116 -17
View File
@@ -4,13 +4,16 @@ 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)
**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!!*
Purpose
--------------
XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. The goal of the library is to get the same power of hand-made forms but spending 1/10 of the time.
XLForm provides a very powerful DSL used to create a form. It keeps track of this specification on runtime, updating the UI on the fly.
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
@@ -23,7 +26,7 @@ What XLForm does
* Loads a form based on a declarative [*form definition*](#how-to-create-a-form "form definition").
* Keeps track of definition changes on runtime to update the form interface accordingly. Further information on [*Dynamic Forms*](#dynamic-forms---how-to-change-the-form-dynamically-at-runtime "Dynamic Forms") section of this readme.
* Supports multivalued sections allowing us to create, delete or reorder rows. For further details see [*Multivalued Sections*](#multivalued-sections "Multivalued Sections") section bellow.
* Supports multivalued sections allowing us to create, delete or reorder rows. For further details see [*Multivalued Sections*](#multivalued-sections-insert-delete-reorder-rows "Multivalued Sections") section bellow.
* Supports [*custom rows definition*](#how-to-create-a-custom-row).
* Supports custom selectors. For further details of how to define your own selectors check [*Custom selectors*](#custom-selectors---selector-row-with-a-custom-selector-view-controller "Custom Selectors") section out.
* Provides several inline selectors such as date picker and picker inline selectors and brings a way to create custom inline selectors.
@@ -325,27 +328,27 @@ static let time = "time"
var form : XLFormDescriptor
var section : XLFormSectionDescriptor
var row : XLFormRowDescriptor
form = XLFormDescriptor(title: "Dates") as XLFormDescriptor
section = XLFormSectionDescriptor.formSectionWithTitle("Inline Dates") as XLFormSectionDescriptor
form.addFormSection(section)
// Date
row = XLFormRowDescriptor(tag: tag.date, rowType: XLFormRowDescriptorTypeDateInline, title:"Date")
row.value = NSDate()
section.addFormRow(row)
// Time
row = XLFormRowDescriptor(tag: tag.time, rowType: XLFormRowDescriptorTypeTimeInline, title: "Time")
row.value = NSDate()
section.addFormRow(row)
// DateTime
row = XLFormRowDescriptor(tag: tag.dateTime, rowType: XLFormRowDescriptorTypeDateTimeInline, title: "Date Time")
row.value = NSDate()
section.addFormRow(row)
self.form = form;
```
@@ -379,6 +382,18 @@ XLForms supports counting using UIStepper control:
```objc
static NSString *const XLFormRowDescriptorTypeStepCounter = @"stepCounter";
```
You can set the stepper paramaters easily:
```objc
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"];
[row.cellConfigAtConfigure setObject:@10 forKey:@"stepControl.minimumValue"];
[row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
```
#####Slider
XLForms supports counting using UISlider control:
@@ -687,7 +702,7 @@ To make the appearance and disappearance of rows and sections automatic, there i
@property id hidden;
```
This id object will normally be a NSPredicate or a NSNumber containing a BOOL. It can be set using any of them or eventually a NSString from which a NSPredicate will be created. In order for this to work the string has to be sintactically correct.
This id object will normally be a NSPredicate or a NSNumber containing a BOOL. It can be set using any of them or eventually a NSString from which a NSPredicate will be created. In order for this to work the string has to be syntactically correct.
For example, you could set the following string to a row (`second`) to make it disappear when a previous row (`first`) contains the value "hide".
@@ -873,6 +888,19 @@ if let fullName = form.formRowWithTag(tag.fullName).value as? String {
}
```
#### How to change UITextField length
You can change the length of a UITextField using the `cellConfigAtConfigure` dictionary property. This value refers to the percentage in relation to the table view cell.
**Objective C**
```objc
[row.cellConfigAtConfigure setObject:[NSNumber numberWithFloat:0.7] forKey:XLFormTextFieldLengthPercentage];
```
**Swift**
```Swift
row.cellConfigAtConfigure.setObject(0.7, forKey:XLFormTextFieldLengthPercentage)
```
#### 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.
@@ -902,19 +930,19 @@ Each XLFormDateCell has a `minimumDate` and a `maximumDate` property. To set a d
```objc
[row.cellConfigAtConfigure setObject:[NSDate new] forKey:@"minimumDate"];
[row.cellConfigAtConfigure setObject:[NSDate dateWithTimeIntervalSinceNow:(60*60*24*3)] forKey:@"maximumDate"];
```
```
**Swift**
```Swift
row.cellConfig.setObject(NSDate(), forKey: "maximumDate")
```
```
####How to disable the entire form (read only mode).
#### How to disable the entire form (read only mode).
`disable` XLFormDescriptor property can be used to disable the entire form. In order to make the displayed cell to take effect we should reload the visible cells ( [self.tableView reloadData] ).
Any other row added after form `disable` property is set to `YES` will reflect the disable mode automatically (no need to reload table view).
####How to hide a row or section when another rows value changes.
#### How to hide a row or section when another rows value changes.
To hide a row or section you should set its hidden property. The easiest way of doing this is by setting a NSString to it. Let's say you want a section to hide if a previous row, which is a boolean switch, is set to 1 (or YES). Then you would do something like this:
```objc
@@ -922,25 +950,65 @@ section.hidden = [NSString stringWithFormat:@"$%@ == 1", previousRow];
```
That is all!
####What do I have to do to migrate from version 2.2.0 to 3.0.0?
#### What do I have to do to migrate from version 2.2.0 to 3.0.0?
The only thing that is not compatible with older versions is that the `disabled` property of the `XLFormRowDescriptor` is an `id` now. So you just have to add `@` before the values you set to it like this:
```objc
row.disabled = @YES; // before: row.disabled = YES;
```
#### How to change input accessory view (navigation view)
Overriding `inputAccessoryViewForRowDescriptor:` `XLFormViewController` method.
If you want to disable it completely you can return nil. But you can also customize its whole appearance here.
```obj-c
- (UIView *)inputAccessoryViewForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
{
return nil; //will hide it completely
// You can use the rowDescriptor parameter to hide/customize the accessory view for a particular rowDescriptor type.
}
```
#### How to set up a pushed view controller?
The view controller that will be pushed must conform to the `XLFormRowDescriptorViewController` protocol which consists of the following property:
```objc
@property (nonatomic) XLFormRowDescriptor * rowDescriptor;
```
This rowDescriptor refers to the selected row of the previous view controller and will be set before the transition to the new controller so that it will be accessible for example in its `viewDidLoad` method. That is where that view controller should be set up.
#### How to change the default appearance of a certain cell
The best way to do this is to extend the class of that cell and override its update and/or configure methods. To make this work you should also update the `cellClassesForRowDescriptorTypes` dictionary in your subclass of XLFormViewController by setting your custom class instead of the class of the cell you wanted to change.
#### How to change the returnKeyType of a cell
To change the returnKeyType of a cell you can set the `returnKeyType` and `nextReturnKeyType` properties. The former will be used if there is no navigation enabled or if there is no row after this row. In the other case the latter will be used.
If you create a custom cell and want to use these you should conform to the `XLFormReturnKeyProtocol` protocol.
This is how you can set them:
```
[row.cellConfigAtConfigure setObject:@(UIReturnKeyGo) forKey:@"nextReturnKeyType"];
```
Installation
--------------------------
The easiest way to use XLForm in your app is via [CocoaPods](http://cocoapods.org/ "CocoaPods").
## Cocoapods
1. Add the following line in the project's Podfile file:
`pod 'XLForm', '~> 3.0.0'`.
`pod 'XLForm', '~> 3.0'`.
2. Run the command `pod install` from the Podfile folder directory.
XLForm **has no** dependencies over other pods.
## Carthage
In your `Cartfile` add:
```
github "xmartlabs/XLForm" ~> 3.0
```
### How to use master branch
@@ -966,12 +1034,41 @@ Requirements
* ARC
* iOS 7.0 and above
* XCode 6.3+
Release Notes
--------------
Version 3.0.0 (master)
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.
@@ -1067,3 +1164,5 @@ Contact
Any suggestion or question? Please create a Github issue or reach us out.
[xmartlabs.com](http://xmartlabs.com) ([@xmartlabs](http://twitter.com/xmartlabs "@xmartlabs"))
[Eureka]: https://github.com/xmartlabs/Eureka
+1 -1
View File
@@ -3,7 +3,7 @@ include FileUtils::Verbose
namespace :test do
desc "Run the XLForm Tests"
task :ios do
run_tests('XLForm Tests', 'iphonesimulator')
run_tests('XLForm Tests', 'iphonesimulator9.2')
tests_failed unless $?.success?
end
end
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'XLForm'
s.version = '3.0.0'
s.version = '3.1.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
@@ -8,7 +8,7 @@ Pod::Spec.new do |s|
DESC
s.homepage = 'https://github.com/xmartlabs/XLForm'
s.authors = { 'Martin Barreto' => 'martin@xmartlabs.com' }
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => 'v3.0.0' }
s.source = { :git => 'https://github.com/xmartlabs/XLForm.git', :tag => s.version }
s.source_files = 'XLForm/XL/**/*.{h,m}'
s.requires_arc = true
s.ios.deployment_target = '7.0'
+636
View File
@@ -0,0 +1,636 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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, ); }; };
E267FD7F1BE804E200F86B42 /* XLFormButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD2F1BE804E200F86B42 /* XLFormButtonCell.m */; };
E267FD801BE804E200F86B42 /* XLFormCheckCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD301BE804E200F86B42 /* XLFormCheckCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD811BE804E200F86B42 /* XLFormCheckCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD311BE804E200F86B42 /* XLFormCheckCell.m */; };
E267FD821BE804E200F86B42 /* XLFormDateCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD321BE804E200F86B42 /* XLFormDateCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD831BE804E200F86B42 /* XLFormDateCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD331BE804E200F86B42 /* XLFormDateCell.m */; };
E267FD841BE804E200F86B42 /* XLFormDatePickerCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD341BE804E200F86B42 /* XLFormDatePickerCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD851BE804E200F86B42 /* XLFormDatePickerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD351BE804E200F86B42 /* XLFormDatePickerCell.m */; };
E267FD861BE804E200F86B42 /* XLFormDescriptorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD361BE804E200F86B42 /* XLFormDescriptorCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD871BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD371BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD881BE804E200F86B42 /* XLFormInlineSelectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD381BE804E200F86B42 /* XLFormInlineSelectorCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD891BE804E200F86B42 /* XLFormInlineSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD391BE804E200F86B42 /* XLFormInlineSelectorCell.m */; };
E267FD8A1BE804E200F86B42 /* XLFormLeftRightSelectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD3A1BE804E200F86B42 /* XLFormLeftRightSelectorCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD8B1BE804E200F86B42 /* XLFormLeftRightSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD3B1BE804E200F86B42 /* XLFormLeftRightSelectorCell.m */; };
E267FD8C1BE804E200F86B42 /* XLFormPickerCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD3C1BE804E200F86B42 /* XLFormPickerCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD8D1BE804E200F86B42 /* XLFormPickerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD3D1BE804E200F86B42 /* XLFormPickerCell.m */; };
E267FD8E1BE804E200F86B42 /* XLFormSegmentedCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD3E1BE804E200F86B42 /* XLFormSegmentedCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD8F1BE804E200F86B42 /* XLFormSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD3F1BE804E200F86B42 /* XLFormSegmentedCell.m */; };
E267FD901BE804E200F86B42 /* XLFormSelectorCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD401BE804E200F86B42 /* XLFormSelectorCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD911BE804E200F86B42 /* XLFormSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD411BE804E200F86B42 /* XLFormSelectorCell.m */; };
E267FD921BE804E200F86B42 /* XLFormSliderCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD421BE804E200F86B42 /* XLFormSliderCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD931BE804E200F86B42 /* XLFormSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD431BE804E200F86B42 /* XLFormSliderCell.m */; };
E267FD941BE804E200F86B42 /* XLFormStepCounterCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD441BE804E200F86B42 /* XLFormStepCounterCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD951BE804E200F86B42 /* XLFormStepCounterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD451BE804E200F86B42 /* XLFormStepCounterCell.m */; };
E267FD961BE804E200F86B42 /* XLFormSwitchCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD461BE804E200F86B42 /* XLFormSwitchCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD971BE804E200F86B42 /* XLFormSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD471BE804E200F86B42 /* XLFormSwitchCell.m */; };
E267FD981BE804E200F86B42 /* XLFormTextFieldCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD481BE804E200F86B42 /* XLFormTextFieldCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD991BE804E200F86B42 /* XLFormTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD491BE804E200F86B42 /* XLFormTextFieldCell.m */; };
E267FD9A1BE804E200F86B42 /* XLFormTextViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD4A1BE804E200F86B42 /* XLFormTextViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD9B1BE804E200F86B42 /* XLFormTextViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD4B1BE804E200F86B42 /* XLFormTextViewCell.m */; };
E267FD9C1BE804E200F86B42 /* XLFormOptionsObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD4D1BE804E200F86B42 /* XLFormOptionsObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD9D1BE804E200F86B42 /* XLFormOptionsObject.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD4E1BE804E200F86B42 /* XLFormOptionsObject.m */; };
E267FD9E1BE804E200F86B42 /* XLFormOptionsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD4F1BE804E200F86B42 /* XLFormOptionsViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FD9F1BE804E200F86B42 /* XLFormOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD501BE804E200F86B42 /* XLFormOptionsViewController.m */; };
E267FDA01BE804E200F86B42 /* XLFormRowDescriptorViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD511BE804E200F86B42 /* XLFormRowDescriptorViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA11BE804E200F86B42 /* XLFormViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD521BE804E200F86B42 /* XLFormViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA21BE804E200F86B42 /* XLFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD531BE804E200F86B42 /* XLFormViewController.m */; };
E267FDA31BE804E200F86B42 /* XLFormDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD551BE804E200F86B42 /* XLFormDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA41BE804E200F86B42 /* XLFormDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD561BE804E200F86B42 /* XLFormDescriptor.m */; };
E267FDA51BE804E200F86B42 /* XLFormDescriptorDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD571BE804E200F86B42 /* XLFormDescriptorDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA61BE804E200F86B42 /* XLFormRowDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD581BE804E200F86B42 /* XLFormRowDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA71BE804E200F86B42 /* XLFormRowDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD591BE804E200F86B42 /* XLFormRowDescriptor.m */; };
E267FDA81BE804E200F86B42 /* XLFormSectionDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD5A1BE804E200F86B42 /* XLFormSectionDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDA91BE804E200F86B42 /* XLFormSectionDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD5B1BE804E200F86B42 /* XLFormSectionDescriptor.m */; };
E267FDAA1BE804E200F86B42 /* NSArray+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD5D1BE804E200F86B42 /* NSArray+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDAB1BE804E200F86B42 /* NSArray+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD5E1BE804E200F86B42 /* NSArray+XLFormAdditions.m */; };
E267FDAC1BE804E200F86B42 /* NSExpression+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD5F1BE804E200F86B42 /* NSExpression+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDAD1BE804E200F86B42 /* NSExpression+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD601BE804E200F86B42 /* NSExpression+XLFormAdditions.m */; };
E267FDAE1BE804E200F86B42 /* NSObject+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD611BE804E200F86B42 /* NSObject+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDAF1BE804E200F86B42 /* NSObject+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD621BE804E200F86B42 /* NSObject+XLFormAdditions.m */; };
E267FDB01BE804E200F86B42 /* NSPredicate+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD631BE804E200F86B42 /* NSPredicate+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDB11BE804E200F86B42 /* NSPredicate+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD641BE804E200F86B42 /* NSPredicate+XLFormAdditions.m */; };
E267FDB21BE804E200F86B42 /* NSString+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD651BE804E200F86B42 /* NSString+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDB31BE804E200F86B42 /* NSString+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD661BE804E200F86B42 /* NSString+XLFormAdditions.m */; };
E267FDB41BE804E200F86B42 /* UIView+XLFormAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD671BE804E200F86B42 /* UIView+XLFormAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDB51BE804E200F86B42 /* UIView+XLFormAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD681BE804E200F86B42 /* UIView+XLFormAdditions.m */; };
E267FDB61BE804E200F86B42 /* XLFormRightDetailCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD6A1BE804E200F86B42 /* XLFormRightDetailCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDB71BE804E200F86B42 /* XLFormRightDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD6B1BE804E200F86B42 /* XLFormRightDetailCell.m */; };
E267FDB81BE804E200F86B42 /* XLFormRightImageButton.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD6C1BE804E200F86B42 /* XLFormRightImageButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDB91BE804E200F86B42 /* XLFormRightImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD6D1BE804E200F86B42 /* XLFormRightImageButton.m */; };
E267FDBA1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD6E1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDBB1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD6F1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.m */; };
E267FDBC1BE804E200F86B42 /* XLFormTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD701BE804E200F86B42 /* XLFormTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDBD1BE804E200F86B42 /* XLFormTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD711BE804E200F86B42 /* XLFormTextView.m */; };
E267FDBE1BE804E200F86B42 /* XLFormRegexValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD731BE804E200F86B42 /* XLFormRegexValidator.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDBF1BE804E200F86B42 /* XLFormRegexValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD741BE804E200F86B42 /* XLFormRegexValidator.m */; };
E267FDC01BE804E200F86B42 /* XLFormValidationStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD751BE804E200F86B42 /* XLFormValidationStatus.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDC11BE804E200F86B42 /* XLFormValidationStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD761BE804E200F86B42 /* XLFormValidationStatus.m */; };
E267FDC21BE804E200F86B42 /* XLFormValidator.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD771BE804E200F86B42 /* XLFormValidator.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDC31BE804E200F86B42 /* XLFormValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD781BE804E200F86B42 /* XLFormValidator.m */; };
E267FDC41BE804E200F86B42 /* XLFormValidatorProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD791BE804E200F86B42 /* XLFormValidatorProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDC51BE804E200F86B42 /* XLForm.h in Headers */ = {isa = PBXBuildFile; fileRef = E267FD7A1BE804E200F86B42 /* XLForm.h */; settings = {ATTRIBUTES = (Public, ); }; };
E267FDC61BE804E200F86B42 /* XLForm.m in Sources */ = {isa = PBXBuildFile; fileRef = E267FD7B1BE804E200F86B42 /* XLForm.m */; };
E267FDC81BE806D000F86B42 /* XLForm.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E267FDC71BE806D000F86B42 /* XLForm.bundle */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
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>"; };
E267FD2D1BE804E200F86B42 /* XLFormBaseCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormBaseCell.m; sourceTree = "<group>"; };
E267FD2E1BE804E200F86B42 /* XLFormButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormButtonCell.h; sourceTree = "<group>"; };
E267FD2F1BE804E200F86B42 /* XLFormButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormButtonCell.m; sourceTree = "<group>"; };
E267FD301BE804E200F86B42 /* XLFormCheckCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormCheckCell.h; sourceTree = "<group>"; };
E267FD311BE804E200F86B42 /* XLFormCheckCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormCheckCell.m; sourceTree = "<group>"; };
E267FD321BE804E200F86B42 /* XLFormDateCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormDateCell.h; sourceTree = "<group>"; };
E267FD331BE804E200F86B42 /* XLFormDateCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormDateCell.m; sourceTree = "<group>"; };
E267FD341BE804E200F86B42 /* XLFormDatePickerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormDatePickerCell.h; sourceTree = "<group>"; };
E267FD351BE804E200F86B42 /* XLFormDatePickerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormDatePickerCell.m; sourceTree = "<group>"; };
E267FD361BE804E200F86B42 /* XLFormDescriptorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormDescriptorCell.h; sourceTree = "<group>"; };
E267FD371BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormInlineRowDescriptorCell.h; sourceTree = "<group>"; };
E267FD381BE804E200F86B42 /* XLFormInlineSelectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormInlineSelectorCell.h; sourceTree = "<group>"; };
E267FD391BE804E200F86B42 /* XLFormInlineSelectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormInlineSelectorCell.m; sourceTree = "<group>"; };
E267FD3A1BE804E200F86B42 /* XLFormLeftRightSelectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormLeftRightSelectorCell.h; sourceTree = "<group>"; };
E267FD3B1BE804E200F86B42 /* XLFormLeftRightSelectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormLeftRightSelectorCell.m; sourceTree = "<group>"; };
E267FD3C1BE804E200F86B42 /* XLFormPickerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormPickerCell.h; sourceTree = "<group>"; };
E267FD3D1BE804E200F86B42 /* XLFormPickerCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormPickerCell.m; sourceTree = "<group>"; };
E267FD3E1BE804E200F86B42 /* XLFormSegmentedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormSegmentedCell.h; sourceTree = "<group>"; };
E267FD3F1BE804E200F86B42 /* XLFormSegmentedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormSegmentedCell.m; sourceTree = "<group>"; };
E267FD401BE804E200F86B42 /* XLFormSelectorCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormSelectorCell.h; sourceTree = "<group>"; };
E267FD411BE804E200F86B42 /* XLFormSelectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormSelectorCell.m; sourceTree = "<group>"; };
E267FD421BE804E200F86B42 /* XLFormSliderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormSliderCell.h; sourceTree = "<group>"; };
E267FD431BE804E200F86B42 /* XLFormSliderCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormSliderCell.m; sourceTree = "<group>"; };
E267FD441BE804E200F86B42 /* XLFormStepCounterCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormStepCounterCell.h; sourceTree = "<group>"; };
E267FD451BE804E200F86B42 /* XLFormStepCounterCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormStepCounterCell.m; sourceTree = "<group>"; };
E267FD461BE804E200F86B42 /* XLFormSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormSwitchCell.h; sourceTree = "<group>"; };
E267FD471BE804E200F86B42 /* XLFormSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormSwitchCell.m; sourceTree = "<group>"; };
E267FD481BE804E200F86B42 /* XLFormTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormTextFieldCell.h; sourceTree = "<group>"; };
E267FD491BE804E200F86B42 /* XLFormTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormTextFieldCell.m; sourceTree = "<group>"; };
E267FD4A1BE804E200F86B42 /* XLFormTextViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormTextViewCell.h; sourceTree = "<group>"; };
E267FD4B1BE804E200F86B42 /* XLFormTextViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormTextViewCell.m; sourceTree = "<group>"; };
E267FD4D1BE804E200F86B42 /* XLFormOptionsObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormOptionsObject.h; sourceTree = "<group>"; };
E267FD4E1BE804E200F86B42 /* XLFormOptionsObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormOptionsObject.m; sourceTree = "<group>"; };
E267FD4F1BE804E200F86B42 /* XLFormOptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormOptionsViewController.h; sourceTree = "<group>"; };
E267FD501BE804E200F86B42 /* XLFormOptionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormOptionsViewController.m; sourceTree = "<group>"; };
E267FD511BE804E200F86B42 /* XLFormRowDescriptorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRowDescriptorViewController.h; sourceTree = "<group>"; };
E267FD521BE804E200F86B42 /* XLFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormViewController.h; sourceTree = "<group>"; };
E267FD531BE804E200F86B42 /* XLFormViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormViewController.m; sourceTree = "<group>"; };
E267FD551BE804E200F86B42 /* XLFormDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormDescriptor.h; sourceTree = "<group>"; };
E267FD561BE804E200F86B42 /* XLFormDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormDescriptor.m; sourceTree = "<group>"; };
E267FD571BE804E200F86B42 /* XLFormDescriptorDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormDescriptorDelegate.h; sourceTree = "<group>"; };
E267FD581BE804E200F86B42 /* XLFormRowDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRowDescriptor.h; sourceTree = "<group>"; };
E267FD591BE804E200F86B42 /* XLFormRowDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormRowDescriptor.m; sourceTree = "<group>"; };
E267FD5A1BE804E200F86B42 /* XLFormSectionDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormSectionDescriptor.h; sourceTree = "<group>"; };
E267FD5B1BE804E200F86B42 /* XLFormSectionDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormSectionDescriptor.m; sourceTree = "<group>"; };
E267FD5D1BE804E200F86B42 /* NSArray+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD5E1BE804E200F86B42 /* NSArray+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD5F1BE804E200F86B42 /* NSExpression+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD601BE804E200F86B42 /* NSExpression+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSExpression+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD611BE804E200F86B42 /* NSObject+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD621BE804E200F86B42 /* NSObject+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD631BE804E200F86B42 /* NSPredicate+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD641BE804E200F86B42 /* NSPredicate+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPredicate+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD651BE804E200F86B42 /* NSString+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD661BE804E200F86B42 /* NSString+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD671BE804E200F86B42 /* UIView+XLFormAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+XLFormAdditions.h"; sourceTree = "<group>"; };
E267FD681BE804E200F86B42 /* UIView+XLFormAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+XLFormAdditions.m"; sourceTree = "<group>"; };
E267FD6A1BE804E200F86B42 /* XLFormRightDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRightDetailCell.h; sourceTree = "<group>"; };
E267FD6B1BE804E200F86B42 /* XLFormRightDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormRightDetailCell.m; sourceTree = "<group>"; };
E267FD6C1BE804E200F86B42 /* XLFormRightImageButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRightImageButton.h; sourceTree = "<group>"; };
E267FD6D1BE804E200F86B42 /* XLFormRightImageButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormRightImageButton.m; sourceTree = "<group>"; };
E267FD6E1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRowNavigationAccessoryView.h; sourceTree = "<group>"; };
E267FD6F1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormRowNavigationAccessoryView.m; sourceTree = "<group>"; };
E267FD701BE804E200F86B42 /* XLFormTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormTextView.h; sourceTree = "<group>"; };
E267FD711BE804E200F86B42 /* XLFormTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormTextView.m; sourceTree = "<group>"; };
E267FD731BE804E200F86B42 /* XLFormRegexValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormRegexValidator.h; sourceTree = "<group>"; };
E267FD741BE804E200F86B42 /* XLFormRegexValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormRegexValidator.m; sourceTree = "<group>"; };
E267FD751BE804E200F86B42 /* XLFormValidationStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormValidationStatus.h; sourceTree = "<group>"; };
E267FD761BE804E200F86B42 /* XLFormValidationStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormValidationStatus.m; sourceTree = "<group>"; };
E267FD771BE804E200F86B42 /* XLFormValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormValidator.h; sourceTree = "<group>"; };
E267FD781BE804E200F86B42 /* XLFormValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormValidator.m; sourceTree = "<group>"; };
E267FD791BE804E200F86B42 /* XLFormValidatorProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormValidatorProtocol.h; sourceTree = "<group>"; };
E267FD7A1BE804E200F86B42 /* XLForm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLForm.h; path = XL/XLForm.h; sourceTree = "<group>"; };
E267FD7B1BE804E200F86B42 /* XLForm.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLForm.m; path = XL/XLForm.m; sourceTree = "<group>"; };
E267FDC71BE806D000F86B42 /* XLForm.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = XLForm.bundle; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
E267FD1C1BE8048900F86B42 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
E267FD161BE8048900F86B42 = {
isa = PBXGroup;
children = (
E267FD221BE8048900F86B42 /* XLForm */,
E267FD211BE8048900F86B42 /* Products */,
);
sourceTree = "<group>";
};
E267FD211BE8048900F86B42 /* Products */ = {
isa = PBXGroup;
children = (
E267FD201BE8048900F86B42 /* XLForm.framework */,
);
name = Products;
sourceTree = "<group>";
};
E267FD221BE8048900F86B42 /* XLForm */ = {
isa = PBXGroup;
children = (
E267FD2B1BE804E200F86B42 /* Cell */,
E267FD4C1BE804E200F86B42 /* Controllers */,
E267FD541BE804E200F86B42 /* Descriptors */,
E267FD5C1BE804E200F86B42 /* Helpers */,
E267FD721BE804E200F86B42 /* Validation */,
E267FD7A1BE804E200F86B42 /* XLForm.h */,
E267FD7B1BE804E200F86B42 /* XLForm.m */,
E267FD251BE8048900F86B42 /* Info.plist */,
E267FDC71BE806D000F86B42 /* XLForm.bundle */,
);
path = XLForm;
sourceTree = "<group>";
};
E267FD2B1BE804E200F86B42 /* Cell */ = {
isa = PBXGroup;
children = (
E267FD2C1BE804E200F86B42 /* XLFormBaseCell.h */,
E267FD2D1BE804E200F86B42 /* XLFormBaseCell.m */,
E267FD2E1BE804E200F86B42 /* XLFormButtonCell.h */,
E267FD2F1BE804E200F86B42 /* XLFormButtonCell.m */,
E267FD301BE804E200F86B42 /* XLFormCheckCell.h */,
E267FD311BE804E200F86B42 /* XLFormCheckCell.m */,
E267FD321BE804E200F86B42 /* XLFormDateCell.h */,
E267FD331BE804E200F86B42 /* XLFormDateCell.m */,
E267FD341BE804E200F86B42 /* XLFormDatePickerCell.h */,
E267FD351BE804E200F86B42 /* XLFormDatePickerCell.m */,
E267FD361BE804E200F86B42 /* XLFormDescriptorCell.h */,
E267FD371BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h */,
E267FD381BE804E200F86B42 /* XLFormInlineSelectorCell.h */,
E267FD391BE804E200F86B42 /* XLFormInlineSelectorCell.m */,
E267FD3A1BE804E200F86B42 /* XLFormLeftRightSelectorCell.h */,
E267FD3B1BE804E200F86B42 /* XLFormLeftRightSelectorCell.m */,
E267FD3C1BE804E200F86B42 /* XLFormPickerCell.h */,
E267FD3D1BE804E200F86B42 /* XLFormPickerCell.m */,
E267FD3E1BE804E200F86B42 /* XLFormSegmentedCell.h */,
E267FD3F1BE804E200F86B42 /* XLFormSegmentedCell.m */,
E267FD401BE804E200F86B42 /* XLFormSelectorCell.h */,
E267FD411BE804E200F86B42 /* XLFormSelectorCell.m */,
E267FD421BE804E200F86B42 /* XLFormSliderCell.h */,
E267FD431BE804E200F86B42 /* XLFormSliderCell.m */,
E267FD441BE804E200F86B42 /* XLFormStepCounterCell.h */,
E267FD451BE804E200F86B42 /* XLFormStepCounterCell.m */,
E267FD461BE804E200F86B42 /* XLFormSwitchCell.h */,
E267FD471BE804E200F86B42 /* XLFormSwitchCell.m */,
E267FD481BE804E200F86B42 /* XLFormTextFieldCell.h */,
E267FD491BE804E200F86B42 /* XLFormTextFieldCell.m */,
E267FD4A1BE804E200F86B42 /* XLFormTextViewCell.h */,
E267FD4B1BE804E200F86B42 /* XLFormTextViewCell.m */,
);
name = Cell;
path = XL/Cell;
sourceTree = "<group>";
};
E267FD4C1BE804E200F86B42 /* Controllers */ = {
isa = PBXGroup;
children = (
E267FD4D1BE804E200F86B42 /* XLFormOptionsObject.h */,
E267FD4E1BE804E200F86B42 /* XLFormOptionsObject.m */,
E267FD4F1BE804E200F86B42 /* XLFormOptionsViewController.h */,
E267FD501BE804E200F86B42 /* XLFormOptionsViewController.m */,
E267FD511BE804E200F86B42 /* XLFormRowDescriptorViewController.h */,
E267FD521BE804E200F86B42 /* XLFormViewController.h */,
E267FD531BE804E200F86B42 /* XLFormViewController.m */,
);
name = Controllers;
path = XL/Controllers;
sourceTree = "<group>";
};
E267FD541BE804E200F86B42 /* Descriptors */ = {
isa = PBXGroup;
children = (
E267FD551BE804E200F86B42 /* XLFormDescriptor.h */,
E267FD561BE804E200F86B42 /* XLFormDescriptor.m */,
E267FD571BE804E200F86B42 /* XLFormDescriptorDelegate.h */,
E267FD581BE804E200F86B42 /* XLFormRowDescriptor.h */,
E267FD591BE804E200F86B42 /* XLFormRowDescriptor.m */,
E267FD5A1BE804E200F86B42 /* XLFormSectionDescriptor.h */,
E267FD5B1BE804E200F86B42 /* XLFormSectionDescriptor.m */,
);
name = Descriptors;
path = XL/Descriptors;
sourceTree = "<group>";
};
E267FD5C1BE804E200F86B42 /* Helpers */ = {
isa = PBXGroup;
children = (
E267FD5D1BE804E200F86B42 /* NSArray+XLFormAdditions.h */,
E267FD5E1BE804E200F86B42 /* NSArray+XLFormAdditions.m */,
E267FD5F1BE804E200F86B42 /* NSExpression+XLFormAdditions.h */,
E267FD601BE804E200F86B42 /* NSExpression+XLFormAdditions.m */,
E267FD611BE804E200F86B42 /* NSObject+XLFormAdditions.h */,
E267FD621BE804E200F86B42 /* NSObject+XLFormAdditions.m */,
E267FD631BE804E200F86B42 /* NSPredicate+XLFormAdditions.h */,
E267FD641BE804E200F86B42 /* NSPredicate+XLFormAdditions.m */,
E267FD651BE804E200F86B42 /* NSString+XLFormAdditions.h */,
E267FD661BE804E200F86B42 /* NSString+XLFormAdditions.m */,
E267FD671BE804E200F86B42 /* UIView+XLFormAdditions.h */,
E267FD681BE804E200F86B42 /* UIView+XLFormAdditions.m */,
E267FD691BE804E200F86B42 /* Views */,
);
name = Helpers;
path = XL/Helpers;
sourceTree = "<group>";
};
E267FD691BE804E200F86B42 /* Views */ = {
isa = PBXGroup;
children = (
E267FD6A1BE804E200F86B42 /* XLFormRightDetailCell.h */,
E267FD6B1BE804E200F86B42 /* XLFormRightDetailCell.m */,
E267FD6C1BE804E200F86B42 /* XLFormRightImageButton.h */,
E267FD6D1BE804E200F86B42 /* XLFormRightImageButton.m */,
E267FD6E1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.h */,
E267FD6F1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.m */,
E267FD701BE804E200F86B42 /* XLFormTextView.h */,
E267FD711BE804E200F86B42 /* XLFormTextView.m */,
);
path = Views;
sourceTree = "<group>";
};
E267FD721BE804E200F86B42 /* Validation */ = {
isa = PBXGroup;
children = (
E267FD731BE804E200F86B42 /* XLFormRegexValidator.h */,
E267FD741BE804E200F86B42 /* XLFormRegexValidator.m */,
E267FD751BE804E200F86B42 /* XLFormValidationStatus.h */,
E267FD761BE804E200F86B42 /* XLFormValidationStatus.m */,
E267FD771BE804E200F86B42 /* XLFormValidator.h */,
E267FD781BE804E200F86B42 /* XLFormValidator.m */,
E267FD791BE804E200F86B42 /* XLFormValidatorProtocol.h */,
);
name = Validation;
path = XL/Validation;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
E267FD1D1BE8048900F86B42 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
E267FD881BE804E200F86B42 /* XLFormInlineSelectorCell.h in Headers */,
E267FD871BE804E200F86B42 /* XLFormInlineRowDescriptorCell.h in Headers */,
E267FDA11BE804E200F86B42 /* XLFormViewController.h in Headers */,
E267FD9C1BE804E200F86B42 /* XLFormOptionsObject.h in Headers */,
E267FD7E1BE804E200F86B42 /* XLFormButtonCell.h in Headers */,
E267FD841BE804E200F86B42 /* XLFormDatePickerCell.h in Headers */,
E267FD961BE804E200F86B42 /* XLFormSwitchCell.h in Headers */,
E267FDA61BE804E200F86B42 /* XLFormRowDescriptor.h in Headers */,
E267FD901BE804E200F86B42 /* XLFormSelectorCell.h in Headers */,
E267FDA81BE804E200F86B42 /* XLFormSectionDescriptor.h in Headers */,
E267FDAE1BE804E200F86B42 /* NSObject+XLFormAdditions.h in Headers */,
E267FD9E1BE804E200F86B42 /* XLFormOptionsViewController.h in Headers */,
E267FD821BE804E200F86B42 /* XLFormDateCell.h in Headers */,
E267FD801BE804E200F86B42 /* XLFormCheckCell.h in Headers */,
E267FD8E1BE804E200F86B42 /* XLFormSegmentedCell.h in Headers */,
E267FD8A1BE804E200F86B42 /* XLFormLeftRightSelectorCell.h in Headers */,
E267FD921BE804E200F86B42 /* XLFormSliderCell.h in Headers */,
E267FD941BE804E200F86B42 /* XLFormStepCounterCell.h in Headers */,
E267FDBA1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.h in Headers */,
E267FDAA1BE804E200F86B42 /* NSArray+XLFormAdditions.h in Headers */,
E267FDB21BE804E200F86B42 /* NSString+XLFormAdditions.h in Headers */,
E267FDB81BE804E200F86B42 /* XLFormRightImageButton.h in Headers */,
E267FDA51BE804E200F86B42 /* XLFormDescriptorDelegate.h in Headers */,
E267FDC41BE804E200F86B42 /* XLFormValidatorProtocol.h in Headers */,
E267FDC21BE804E200F86B42 /* XLFormValidator.h in Headers */,
E267FDAC1BE804E200F86B42 /* NSExpression+XLFormAdditions.h in Headers */,
E267FDB61BE804E200F86B42 /* XLFormRightDetailCell.h in Headers */,
E267FDB01BE804E200F86B42 /* NSPredicate+XLFormAdditions.h in Headers */,
E267FDBC1BE804E200F86B42 /* XLFormTextView.h in Headers */,
E267FDC01BE804E200F86B42 /* XLFormValidationStatus.h in Headers */,
E267FDB41BE804E200F86B42 /* UIView+XLFormAdditions.h in Headers */,
E267FD8C1BE804E200F86B42 /* XLFormPickerCell.h in Headers */,
E267FDBE1BE804E200F86B42 /* XLFormRegexValidator.h in Headers */,
E267FD9A1BE804E200F86B42 /* XLFormTextViewCell.h in Headers */,
E267FDC51BE804E200F86B42 /* XLForm.h in Headers */,
E267FDA31BE804E200F86B42 /* XLFormDescriptor.h in Headers */,
E267FD981BE804E200F86B42 /* XLFormTextFieldCell.h in Headers */,
E267FD7C1BE804E200F86B42 /* XLFormBaseCell.h in Headers */,
E267FD861BE804E200F86B42 /* XLFormDescriptorCell.h in Headers */,
E267FDA01BE804E200F86B42 /* XLFormRowDescriptorViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
E267FD1F1BE8048900F86B42 /* XLForm */ = {
isa = PBXNativeTarget;
buildConfigurationList = E267FD281BE8048900F86B42 /* Build configuration list for PBXNativeTarget "XLForm" */;
buildPhases = (
E267FD1B1BE8048900F86B42 /* Sources */,
E267FD1C1BE8048900F86B42 /* Frameworks */,
E267FD1D1BE8048900F86B42 /* Headers */,
E267FD1E1BE8048900F86B42 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = XLForm;
productName = XLForm;
productReference = E267FD201BE8048900F86B42 /* XLForm.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
E267FD171BE8048900F86B42 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
ORGANIZATIONNAME = XLForm;
TargetAttributes = {
E267FD1F1BE8048900F86B42 = {
CreatedOnToolsVersion = 7.1;
};
};
};
buildConfigurationList = E267FD1A1BE8048900F86B42 /* Build configuration list for PBXProject "XLForm" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = E267FD161BE8048900F86B42;
productRefGroup = E267FD211BE8048900F86B42 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
E267FD1F1BE8048900F86B42 /* XLForm */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
E267FD1E1BE8048900F86B42 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E267FDC81BE806D000F86B42 /* XLForm.bundle in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E267FD1B1BE8048900F86B42 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E267FDB51BE804E200F86B42 /* UIView+XLFormAdditions.m in Sources */,
E267FDC11BE804E200F86B42 /* XLFormValidationStatus.m in Sources */,
E267FDBD1BE804E200F86B42 /* XLFormTextView.m in Sources */,
E267FDB91BE804E200F86B42 /* XLFormRightImageButton.m in Sources */,
E267FDAB1BE804E200F86B42 /* NSArray+XLFormAdditions.m in Sources */,
E267FD811BE804E200F86B42 /* XLFormCheckCell.m in Sources */,
E267FDB71BE804E200F86B42 /* XLFormRightDetailCell.m in Sources */,
E267FD831BE804E200F86B42 /* XLFormDateCell.m in Sources */,
E267FD9B1BE804E200F86B42 /* XLFormTextViewCell.m in Sources */,
E267FD8F1BE804E200F86B42 /* XLFormSegmentedCell.m in Sources */,
E267FDAD1BE804E200F86B42 /* NSExpression+XLFormAdditions.m in Sources */,
E267FDBF1BE804E200F86B42 /* XLFormRegexValidator.m in Sources */,
E267FDC31BE804E200F86B42 /* XLFormValidator.m in Sources */,
E267FD931BE804E200F86B42 /* XLFormSliderCell.m in Sources */,
E267FDB11BE804E200F86B42 /* NSPredicate+XLFormAdditions.m in Sources */,
E267FDA41BE804E200F86B42 /* XLFormDescriptor.m in Sources */,
E267FD8B1BE804E200F86B42 /* XLFormLeftRightSelectorCell.m in Sources */,
E267FD9F1BE804E200F86B42 /* XLFormOptionsViewController.m in Sources */,
E267FD8D1BE804E200F86B42 /* XLFormPickerCell.m in Sources */,
E267FD951BE804E200F86B42 /* XLFormStepCounterCell.m in Sources */,
E267FDBB1BE804E200F86B42 /* XLFormRowNavigationAccessoryView.m in Sources */,
E267FD7D1BE804E200F86B42 /* XLFormBaseCell.m in Sources */,
E267FDA21BE804E200F86B42 /* XLFormViewController.m in Sources */,
E267FDB31BE804E200F86B42 /* NSString+XLFormAdditions.m in Sources */,
E267FD851BE804E200F86B42 /* XLFormDatePickerCell.m in Sources */,
E267FDAF1BE804E200F86B42 /* NSObject+XLFormAdditions.m in Sources */,
E267FD991BE804E200F86B42 /* XLFormTextFieldCell.m in Sources */,
E267FD9D1BE804E200F86B42 /* XLFormOptionsObject.m in Sources */,
E267FD7F1BE804E200F86B42 /* XLFormButtonCell.m in Sources */,
E267FD911BE804E200F86B42 /* XLFormSelectorCell.m in Sources */,
E267FDA91BE804E200F86B42 /* XLFormSectionDescriptor.m in Sources */,
E267FD971BE804E200F86B42 /* XLFormSwitchCell.m in Sources */,
E267FDC61BE804E200F86B42 /* XLForm.m in Sources */,
E267FD891BE804E200F86B42 /* XLFormInlineSelectorCell.m in Sources */,
E267FDA71BE804E200F86B42 /* XLFormRowDescriptor.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
E267FD261BE8048900F86B42 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
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";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3.0.2;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
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",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
E267FD271BE8048900F86B42 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
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";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3.0.2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
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;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
E267FD291BE8048900F86B42 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = XLForm/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLForm;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
E267FD2A1BE8048900F86B42 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = XLForm/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.XLForm;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
E267FD1A1BE8048900F86B42 /* Build configuration list for PBXProject "XLForm" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E267FD261BE8048900F86B42 /* Debug */,
E267FD271BE8048900F86B42 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E267FD281BE8048900F86B42 /* Build configuration list for PBXNativeTarget "XLForm" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E267FD291BE8048900F86B42 /* Debug */,
E267FD2A1BE8048900F86B42 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E267FD171BE8048900F86B42 /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:XLForm.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E267FD1F1BE8048900F86B42"
BuildableName = "XLForm.framework"
BlueprintName = "XLForm"
ReferencedContainer = "container:XLForm.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E267FD1F1BE8048900F86B42"
BuildableName = "XLForm.framework"
BlueprintName = "XLForm"
ReferencedContainer = "container:XLForm.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E267FD1F1BE8048900F86B42"
BuildableName = "XLForm.framework"
BlueprintName = "XLForm"
ReferencedContainer = "container:XLForm.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
+7
View File
@@ -40,4 +40,11 @@
@end
@protocol XLFormReturnKeyProtocol
@property UIReturnKeyType returnKeyType;
@property UIReturnKeyType nextReturnKeyType;
@end
-5
View File
@@ -27,11 +27,6 @@
@implementation XLFormBaseCell
- (id)init
{
return [self initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+16 -6
View File
@@ -30,7 +30,7 @@
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
return [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
return [super initWithStyle:style reuseIdentifier:reuseIdentifier];
}
@@ -46,11 +46,21 @@
[super update];
BOOL isDisabled = self.rowDescriptor.isDisabled;
self.textLabel.text = self.rowDescriptor.title;
BOOL leftAligmnment = self.rowDescriptor.action.viewControllerClass || [self.rowDescriptor.action.viewControllerStoryboardId length] != 0 || [self.rowDescriptor.action.viewControllerNibName length] != 0 || [self.rowDescriptor.action.formSegueIdenfifier length] != 0 || self.rowDescriptor.action.formSegueClass;
self.textLabel.textAlignment = leftAligmnment ? NSTextAlignmentLeft : NSTextAlignmentCenter;
self.accessoryType = !leftAligmnment || isDisabled ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator;;
BOOL notASimpleAction = self.rowDescriptor.action.viewControllerClass || [self.rowDescriptor.action.viewControllerStoryboardId length] != 0 || [self.rowDescriptor.action.viewControllerNibName length] != 0 || [self.rowDescriptor.action.formSegueIdentifier length] != 0 || self.rowDescriptor.action.formSegueClass;
self.textLabel.textAlignment = notASimpleAction ? NSTextAlignmentNatural : NSTextAlignmentCenter;
self.accessoryType = !notASimpleAction || isDisabled ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator;
self.editingAccessoryType = self.accessoryType;
self.selectionStyle = isDisabled ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleDefault;
if (!notASimpleAction){
CGFloat red, green, blue, alpha;
[self.tintColor getRed:&red green:&green blue:&blue alpha:&alpha];
self.textLabel.textColor = [UIColor colorWithRed:red green:green blue:blue alpha:(isDisabled ? 0.3 : 1.0)];
}
else{
self.textLabel.textColor = nil;
}
self.detailTextLabel.text = self.rowDescriptor.value;
}
@@ -62,8 +72,8 @@
else if (self.rowDescriptor.action.formSelector){
[controller performFormSelector:self.rowDescriptor.action.formSelector withObject:self.rowDescriptor];
}
else if ([self.rowDescriptor.action.formSegueIdenfifier length] != 0){
[controller performSegueWithIdentifier:self.rowDescriptor.action.formSegueIdenfifier sender:self.rowDescriptor];
else if ([self.rowDescriptor.action.formSegueIdentifier length] != 0){
[controller performSegueWithIdentifier:self.rowDescriptor.action.formSegueIdentifier sender:self.rowDescriptor];
}
else if (self.rowDescriptor.action.formSegueClass){
UIViewController * controllerToPresent = [self controllerToPresent];
+5 -1
View File
@@ -59,6 +59,9 @@
-(BOOL)becomeFirstResponder
{
if (self.isFirstResponder){
return [super becomeFirstResponder];
}
_beforeChangeColor = self.detailTextLabel.textColor;
BOOL result = [super becomeFirstResponder];
if (result){
@@ -78,6 +81,7 @@
inlineCell.inlineRowDescriptor = self.rowDescriptor;
[formSection addFormRow:datePickerRowDescriptor afterRow:self.rowDescriptor];
[self.formViewController ensureRowIsVisible:datePickerRowDescriptor];
}
}
return result;
@@ -223,7 +227,7 @@
- (void)datePickerValueChanged:(UIDatePicker *)sender
{
self.rowDescriptor.value = sender.date;
self.detailTextLabel.text = [self valueDisplayText];
[self update];
[self setNeedsLayout];
}
@@ -1,5 +1,5 @@
//
// UserLocalDataLoader.h
// XLFormBaseCell.h
// XLForm ( https://github.com/xmartlabs/XLForm )
//
// Copyright (c) 2015 Xmartlabs ( http://xmartlabs.com )
@@ -23,8 +23,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "XLLocalDataLoader.h"
#import "XLFormBaseCell.h"
@interface UserLocalDataLoader : XLLocalDataLoader
@interface XLFormImageCell : XLFormBaseCell
@end
+145
View File
@@ -0,0 +1,145 @@
//
// XLFormBaseCell.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 "XLFormImageCell.h"
#import "XLFormRowDescriptor.h"
#import "UIView+XLFormAdditions.h"
@interface XLFormImageCell() <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
UIPopoverController *popoverController;
UIImagePickerController *imagePickerController;
UIAlertController *alertController;
}
@end
@implementation XLFormImageCell
#pragma mark - XLFormDescriptorCell
+ (CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor
{
return 40;
}
- (void)configure
{
[super configure];
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.accessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
self.editingAccessoryView = self.accessoryView;
}
- (void)update
{
[super update];
self.textLabel.text = self.rowDescriptor.title;
self.imageView.image = self.rowDescriptor.value;
}
- (void)chooseImage:(UIImage *)image
{
self.imageView.image = image;
self.rowDescriptor.value = image;
}
- (UIImageView *)imageView
{
return (UIImageView *)self.accessoryView;
}
- (void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller
{
alertController = [UIAlertController alertControllerWithTitle: self.rowDescriptor.title
message: nil
preferredStyle: UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle: NSLocalizedString(@"Choose From Library", nil)
style: UIAlertActionStyleDefault
handler: ^(UIAlertAction * _Nonnull action) {
[self openImage:UIImagePickerControllerSourceTypePhotoLibrary];
}]];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[alertController addAction:[UIAlertAction actionWithTitle: NSLocalizedString(@"Take Photo", nil)
style: UIAlertActionStyleDefault
handler: ^(UIAlertAction * _Nonnull action) {
[self openImage:UIImagePickerControllerSourceTypeCamera];
}]];
}
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
alertController.modalPresentationStyle = UIModalPresentationPopover;
alertController.popoverPresentationController.sourceView = self.contentView;
alertController.popoverPresentationController.sourceRect = self.contentView.bounds;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.formViewController presentViewController:alertController animated: true completion: nil];
});
}
- (void)openImage:(UIImagePickerControllerSourceType)source
{
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
imagePickerController.sourceType = source;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popoverController presentPopoverFromRect: self.contentView.frame
inView: self.formViewController.view
permittedArrowDirections: UIPopoverArrowDirectionAny
animated: YES];
} else {
[self.formViewController presentViewController: imagePickerController
animated: YES
completion: nil];
}
}
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
UIImage *editedImage = info[UIImagePickerControllerEditedImage];
UIImage *originalImage = info[UIImagePickerControllerOriginalImage];
if (editedImage) {
[self chooseImage:editedImage];
} else {
[self chooseImage:originalImage];
}
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (popoverController && popoverController.isPopoverVisible) {
[popoverController dismissPopoverAnimated: YES];
}
} else {
[self.formViewController dismissViewControllerAnimated: YES completion: nil];
}
}
@end
+10 -1
View File
@@ -42,6 +42,9 @@
-(BOOL)becomeFirstResponder
{
if (self.isFirstResponder){
return [super becomeFirstResponder];
}
_beforeChangeColor = self.detailTextLabel.textColor;
BOOL result = [super becomeFirstResponder];
if (result){
@@ -51,18 +54,24 @@
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];
[formSection removeFormRow:nextFormRow];
if (result) {
[formSection removeFormRow:nextFormRow];
}
return result;
}
+49 -3
View File
@@ -123,7 +123,7 @@
NSDictionary * views = @{@"leftButton" : self.leftButton, @"rightLabel": self.rightLabel, @"separatorView": separatorView, @"constraintTextField": _constraintTextField };
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.leftButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0.0f]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[constraintTextField]" options:0 metrics:nil views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-16-[leftButton]-[separatorView(1)]-[rightLabel]-14-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[leftButton]-[separatorView(1)]-[rightLabel]-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[separatorView(20)]" options:0 metrics:nil views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-12-[constraintTextField]-12-|" options:0 metrics:0 views:views]];
}
@@ -182,15 +182,59 @@
-(void)leftButtonPressed:(UIButton *)leftButton
{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
actionSheet.tag = [self.rowDescriptor hash];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
[actionSheet addButtonWithTitle:[leftOption.leftValue displayText]];
}
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
actionSheet.tag = [self.rowDescriptor hash];
[actionSheet showInView:self.formViewController.view];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil]];
__weak __typeof(self)weakSelf = self;
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
[alertController addAction:[UIAlertAction actionWithTitle:[leftOption.leftValue displayText]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
weakSelf.rowDescriptor.value = nil;
weakSelf.rowDescriptor.leftRightSelectorLeftOptionSelected = [self leftOptionForDescription:[leftOption.leftValue displayText]].leftValue;
[weakSelf.formViewController updateFormRow:weakSelf.rowDescriptor];
}]];
}
[self.formViewController presentViewController:alertController animated:YES completion:nil];
}
else{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (XLFormLeftRightSelectorOption * leftOption in self.rowDescriptor.selectorOptions) {
[actionSheet addButtonWithTitle:[leftOption.leftValue displayText]];
}
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
actionSheet.tag = [self.rowDescriptor hash];
[actionSheet showInView:self.formViewController.view];
}
#endif
}
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
@@ -205,5 +249,7 @@
}
}
#endif
@end
+2 -2
View File
@@ -140,7 +140,7 @@
self.dynamicCustomConstraints = [NSMutableArray array];
NSDictionary * views = @{@"segmentedControl": self.segmentedControl, @"textLabel": self.textLabel};
if (self.textLabel.text.length > 0){
[self.dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-16-[textLabel]-16-[segmentedControl]-16-|"
[self.dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textLabel]-16-[segmentedControl]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:0
views:views]];
@@ -151,7 +151,7 @@
}
else{
[self.dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-16-[segmentedControl]-16-|"
[self.dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[segmentedControl]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:0
views:views]];
+90 -7
View File
@@ -141,7 +141,6 @@
[super update];
self.accessoryType = self.rowDescriptor.isDisabled || !([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPush] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeMultipleSelector]) ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator;;
self.editingAccessoryType = self.accessoryType;
[self.textLabel setText:self.rowDescriptor.title];
self.selectionStyle = self.rowDescriptor.isDisabled || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeInfo] ? UITableViewCellSelectionStyleNone : UITableViewCellSelectionStyleDefault;
self.textLabel.text = [NSString stringWithFormat:@"%@%@", self.rowDescriptor.title, self.rowDescriptor.required && self.rowDescriptor.sectionDescriptor.formDescriptor.addAsteriskToRequiredRowsTitle ? @"*" : @""];
self.detailTextLabel.text = [self valueDisplayText];
@@ -151,8 +150,8 @@
{
if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPush] || [self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPopover]){
UIViewController * controllerToPresent = nil;
if (self.rowDescriptor.action.formSegueIdenfifier){
[controller performSegueWithIdentifier:self.rowDescriptor.action.formSegueIdenfifier sender:self.rowDescriptor];
if (self.rowDescriptor.action.formSegueIdentifier){
[controller performSegueWithIdentifier:self.rowDescriptor.action.formSegueIdentifier sender:self.rowDescriptor];
}
else if (self.rowDescriptor.action.formSegueClass){
UIViewController * controllerToPresent = [self controllerToPresent];
@@ -233,23 +232,103 @@
}
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorActionSheet]){
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
actionSheet.tag = [self.rowDescriptor hash];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (id option in self.rowDescriptor.selectorOptions) {
[actionSheet addButtonWithTitle:[option displayText]];
}
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
actionSheet.tag = [self.rowDescriptor hash];
[actionSheet showInView:controller.view];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil]];
__weak __typeof(self)weakSelf = self;
for (id option in self.rowDescriptor.selectorOptions) {
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[weakSelf.rowDescriptor setValue:option];
[weakSelf.formViewController.tableView reloadData];
}]];
}
[self.formViewController presentViewController:alertController animated:YES completion:nil];
}
else{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:self.rowDescriptor.selectorTitle
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
for (id option in self.rowDescriptor.selectorOptions) {
[actionSheet addButtonWithTitle:[option displayText]];
}
actionSheet.cancelButtonIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
actionSheet.tag = [self.rowDescriptor hash];
[actionSheet showInView:controller.view];
}
#endif
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorAlertView]){
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
alertView.tag = [self.rowDescriptor hash];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle
message:nil
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
for (id option in self.rowDescriptor.selectorOptions) {
[alertView addButtonWithTitle:[option displayText]];
}
alertView.cancelButtonIndex = [alertView addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
alertView.tag = [self.rowDescriptor hash];
[alertView show];
#else
if ([UIAlertController class]) {
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:self.rowDescriptor.selectorTitle
message:nil
preferredStyle:UIAlertControllerStyleAlert];
__weak __typeof(self)weakSelf = self;
for (id option in self.rowDescriptor.selectorOptions) {
[alertController addAction:[UIAlertAction actionWithTitle:[option displayText]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
[weakSelf.rowDescriptor setValue:option];
[weakSelf.formViewController.tableView reloadData];
}]];
}
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleCancel
handler:nil]];
[controller presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:self.rowDescriptor.selectorTitle
message:nil
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
for (id option in self.rowDescriptor.selectorOptions) {
[alertView addButtonWithTitle:[option displayText]];
}
alertView.cancelButtonIndex = [alertView addButtonWithTitle:NSLocalizedString(@"Cancel", nil)];
alertView.tag = [self.rowDescriptor hash];
[alertView show];
}
#endif
[controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES];
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeSelectorPickerView]){
@@ -270,6 +349,8 @@
self.detailTextLabel.textColor = _beforeChangeColor;
}
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
@@ -307,6 +388,8 @@
}
}
#endif
#pragma mark - UIPickerViewDelegate
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
+2 -2
View File
@@ -47,8 +47,8 @@
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1 constant:10]];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.slider attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1 constant:44]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-15-[textLabel]-15-|" options:0 metrics:0 views:@{@"textLabel": self.textLabel}]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-15-[slider]-15-|" options:0 metrics:0 views:@{@"slider": self.slider}]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textLabel]-|" options:0 metrics:0 views:@{@"textLabel": self.textLabel}]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[slider]-|" options:0 metrics:0 views:@{@"slider": self.slider}]];
[self valueChanged:nil];
}
+38 -43
View File
@@ -26,14 +26,20 @@
#import "XLFormStepCounterCell.h"
#import "XLFormRowDescriptor.h"
#import "UIView+XLFormAdditions.h"
@interface XLFormStepCounterCell ()
@property (nonatomic) UIStepper *stepControl;
@property (nonatomic) UILabel *currentStepValue;
@end
@implementation XLFormStepCounterCell
#pragma mark - XLFormStepCounterCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
@@ -46,27 +52,16 @@
{
[super configure];
self.selectionStyle = UITableViewCellSelectionStyleNone;
UIStepper *stepperControl = [[UIStepper alloc] initWithFrame:CGRectMake(25,
0,
0,
0)];
[stepperControl addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
UILabel *currentStepValue = [[UILabel alloc] initWithFrame:CGRectMake(0,
0,
25,
CGRectGetHeight(stepperControl.frame))];
currentStepValue.textAlignment = NSTextAlignmentCenter;
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0,
0,
CGRectGetWidth(stepperControl.frame) + CGRectGetWidth(currentStepValue.frame),
CGRectGetHeight(stepperControl.frame))];
[container addSubview:stepperControl];
[container addSubview:currentStepValue];
// Add subviews
[self.contentView addSubview:self.stepControl];
[self.contentView addSubview:self.currentStepValue];
self.accessoryView = container;
self.editingAccessoryView = container;
// Add constraints
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.stepControl attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.currentStepValue attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.currentStepValue attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.stepControl attribute:NSLayoutAttributeHeight multiplier:1 constant:0]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[value]-5-[control]-|" options:0 metrics:0 views:@{@"value": self.currentStepValue, @"control":self.stepControl}]];
}
- (void)update
@@ -74,6 +69,7 @@
[super update];
self.textLabel.text = self.rowDescriptor.title;
self.stepControl.value = [self.rowDescriptor.value doubleValue];
self.currentStepValue.text = self.rowDescriptor.value ? [NSString stringWithFormat:@"%@", self.rowDescriptor.value] : nil;
[self stepControl].enabled = !self.rowDescriptor.isDisabled;
[self currentStepValue].font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
CGFloat red, green, blue, alpha;
@@ -87,40 +83,39 @@
[self setTintColor:[UIColor colorWithRed:red green:green blue:blue alpha:1]];
[self currentStepValue].textColor = [UIColor colorWithRed:red green:green blue:blue alpha:1];
}
[self valueChanged:nil];
}
- (UIStepper *)stepControl
{
for (UIView *view in self.accessoryView.subviews) {
if ([view isMemberOfClass:[UIStepper class]]) {
return (UIStepper *)view;
}
}
return nil;
}
- (UILabel *)currentStepValue
{
for (UIView *view in self.accessoryView.subviews) {
if ([view isMemberOfClass:[UILabel class]]) {
return (UILabel *)view;
}
}
return nil;
}
#pragma mark - Events
- (void)valueChanged:(id)sender
{
UIStepper *stepper = self.stepControl;
self.rowDescriptor.value = stepper.value == 0 ? nil : @(stepper.value);
self.currentStepValue.text = stepper.value == 0 ? nil : [NSString stringWithFormat:@"%.f", stepper.value];
self.rowDescriptor.value = @(stepper.value);
self.currentStepValue.text = [NSString stringWithFormat:@"%.f", stepper.value];
}
#pragma mark - Properties
- (UIStepper *)stepControl
{
if (!_stepControl) {
_stepControl = [UIStepper autolayoutView];
[_stepControl addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
}
return _stepControl;
}
-(UILabel *)currentStepValue
{
if (!_currentStepValue) {
_currentStepValue = [UILabel autolayoutView];
}
return _currentStepValue;
}
@end
+5 -2
View File
@@ -24,12 +24,15 @@
// THE SOFTWARE.
#import "XLFormBaseCell.h"
#import <UIKit/UIKit.h>
@interface XLFormTextFieldCell : XLFormBaseCell
extern NSString *const XLFormTextFieldLengthPercentage;
@interface XLFormTextFieldCell : XLFormBaseCell <XLFormReturnKeyProtocol>
@property (nonatomic, readonly) UILabel * textLabel;
@property (nonatomic, readonly) UITextField * textField;
@property (nonatomic) NSNumber *textFieldLengthPercentage;
@end
+41 -13
View File
@@ -29,10 +29,11 @@
#import "XLForm.h"
#import "XLFormTextFieldCell.h"
NSString *const XLFormTextFieldLengthPercentage = @"textFieldLengthPercentage";
@interface XLFormTextFieldCell() <UITextFieldDelegate>
@property NSArray * dynamicCustomConstraints;
@property UIReturnKeyType returnKeyType;
@property NSMutableArray * dynamicCustomConstraints;
@end
@@ -40,6 +41,8 @@
@synthesize textField = _textField;
@synthesize textLabel = _textLabel;
@synthesize returnKeyType = _returnKeyType;
@synthesize nextReturnKeyType = _nextReturnKeyType;
#pragma mark - KVO
@@ -53,6 +56,16 @@
}
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_returnKeyType = UIReturnKeyDefault;
_nextReturnKeyType = UIReturnKeyNext;
}
return self;
}
-(void)dealloc
{
[self.textLabel removeObserver:self forKeyPath:@"text"];
@@ -128,9 +141,14 @@
self.textField.autocorrectionType = UITextAutocorrectionTypeNo;
self.textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
}
else if ([self.rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeZipCode]){
self.textField.autocorrectionType = UITextAutocorrectionTypeNo;
self.textField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
self.textField.keyboardType = UIKeyboardTypeDefault;
}
self.textLabel.text = ((self.rowDescriptor.required && self.rowDescriptor.title && self.rowDescriptor.sectionDescriptor.formDescriptor.addAsteriskToRequiredRowsTitle) ? [NSString stringWithFormat:@"%@*", self.rowDescriptor.title] : self.rowDescriptor.title);
self.textField.text = self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText;
[self.textField setEnabled:!self.rowDescriptor.isDisabled];
self.textField.textColor = self.rowDescriptor.isDisabled ? [UIColor grayColor] : [UIColor blackColor];
@@ -180,11 +198,13 @@
-(NSArray *)layoutConstraints
{
NSMutableArray * result = [[NSMutableArray alloc] init];
[self.textLabel setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal];
[self.textLabel setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal];
[self.textLabel setContentCompressionResistancePriority:1000 forAxis:UILayoutConstraintAxisHorizontal];
// Add Constraints
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=11)-[_textField]-(>=11)-|" options:NSLayoutFormatAlignAllBaseline metrics:nil views:NSDictionaryOfVariableBindings(_textField)]];
[result addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(>=11)-[_textLabel]-(>=11)-|" options:NSLayoutFormatAlignAllBaseline metrics:nil views:NSDictionaryOfVariableBindings(_textLabel)]];
return result;
}
@@ -194,24 +214,31 @@
[self.contentView removeConstraints:self.dynamicCustomConstraints];
}
NSDictionary * views = @{@"label": self.textLabel, @"textField": self.textField, @"image": self.imageView};
NSDictionary *metrics = @{@"leftMargin" : @16.0, @"rightMargin" : self.textField.textAlignment == NSTextAlignmentRight ? @16.0 : @4.0};
if (self.imageView.image){
if (self.textLabel.text.length > 0){
self.dynamicCustomConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[image]-[label]-[textField]-(rightMargin)-|" options:0 metrics:metrics views:views];
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[image]-[label]-[textField]-|" options:0 metrics:nil views:views]];
}
else{
self.dynamicCustomConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[image]-[textField]-(rightMargin)-|" options:0 metrics:metrics views:views];
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[image]-[textField]-|" options:0 metrics:nil views:views]];
}
}
else{
if (self.textLabel.text.length > 0){
self.dynamicCustomConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(leftMargin)-[label]-[textField]-(rightMargin)-|" options:0 metrics:metrics views:views];
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label]-[textField]-|" options:0 metrics:nil views:views]];
}
else{
self.dynamicCustomConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(leftMargin)-[textField]-(rightMargin)-|" options:0 metrics:metrics views:views];
self.dynamicCustomConstraints = [NSMutableArray arrayWithArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textField]-|" options:0 metrics:nil views:views]];
}
}
[self.dynamicCustomConstraints addObject:[NSLayoutConstraint constraintWithItem:_textField
attribute:NSLayoutAttributeWidth
relatedBy:self.textFieldLengthPercentage ? NSLayoutRelationEqual : NSLayoutRelationGreaterThanOrEqual
toItem:self.contentView
attribute:NSLayoutAttributeWidth
multiplier:self.textFieldLengthPercentage ? [self.textFieldLengthPercentage floatValue] : 0.3
constant:0.0]];
[self.contentView addConstraints:self.dynamicCustomConstraints];
[super updateConstraints];
}
@@ -275,12 +302,13 @@
-(void)setReturnKeyType:(UIReturnKeyType)returnKeyType
{
_returnKeyType = returnKeyType;
self.textField.returnKeyType = returnKeyType;
}
-(UIReturnKeyType)returnKeyType
{
return self.textField.returnKeyType;
return _returnKeyType;
}
@end
+2 -2
View File
@@ -155,10 +155,10 @@ NSString *const kFormTextViewCellPlaceholder = @"placeholder";
}
NSDictionary * views = @{@"label": self.textLabel, @"textView": self.textView};
if (!self.textLabel.text || [self.textLabel.text isEqualToString:@""]){
[_dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-16-[textView]-16-|" options:0 metrics:0 views:views]];
[_dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textView]-|" options:0 metrics:0 views:views]];
}
else{
[_dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-16-[label]-[textView]-4-|" options:0 metrics:0 views:views]];
[_dynamicCustomConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label]-[textView]-|" options:0 metrics:0 views:views]];
}
[self.contentView addConstraints:_dynamicCustomConstraints];
[super updateConstraints];
+1 -1
View File
@@ -26,7 +26,7 @@
#import "XLFormRowDescriptor.h"
#import <Foundation/Foundation.h>
@interface XLFormOptionsObject : NSObject <XLFormOptionObject>
@interface XLFormOptionsObject : NSObject <XLFormOptionObject,NSCoding>
+(XLFormOptionsObject *)formOptionsObjectWithValue:(id)value displayText:(NSString *)displayText;
+(XLFormOptionsObject *)formOptionsOptionForValue:(id)value fromOptions:(NSArray *)options;
+23 -1
View File
@@ -85,5 +85,27 @@
{
return _formValue;
}
#pragma mark - NSCoding
-(void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeObject:self.formValue
forKey:@"formValue"];
[encoder encodeObject:self.formDisplayText
forKey:@"formDisplayText"];
}
-(id)initWithCoder:(NSCoder *)decoder
{
if ((self=[super init])) {
[self setValue:[decoder decodeObjectForKey:@"formValue"]
forKey:@"formValue"];
[self setValue:[decoder decodeObjectForKey:@"formDisplayText"]
forKey:@"formDisplaytext"];
}
return self;
}
@end
@@ -74,6 +74,8 @@ typedef NS_ENUM(NSUInteger, XLFormRowNavigationDirection) {
-(void)beginEditing:(XLFormRowDescriptor *)rowDescriptor;
-(void)endEditing:(XLFormRowDescriptor *)rowDescriptor;
-(void)ensureRowIsVisible:(XLFormRowDescriptor *)inlineRowDescriptor;
@end
@interface XLFormViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, XLFormDescriptorDelegate, UITextFieldDelegate, UITextViewDelegate, UIActionSheetDelegate, XLFormViewControllerDelegate>
+89 -21
View File
@@ -53,7 +53,10 @@
@interface XLFormViewController()
{
NSNumber *_oldBottomTableContentInset;
CGRect _keyboardFrame;
}
@property UITableViewStyle tableViewStyle;
@property (nonatomic) XLFormRowNavigationAccessoryView * navigationAccessoryView;
@@ -117,6 +120,9 @@
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds
style:self.tableViewStyle];
self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
if([self.tableView respondsToSelector:@selector(cellLayoutMarginsFollowReadableWidth)]){
self.tableView.cellLayoutMarginsFollowReadableWidth = NO;
}
}
if (!self.tableView.superview){
[self.view addSubview:self.tableView];
@@ -137,6 +143,7 @@
[self.tableView setEditing:YES animated:NO];
self.tableView.allowsSelectionDuringEditing = YES;
self.form.delegate = self;
_oldBottomTableContentInset = nil;
}
-(void)viewWillAppear:(BOOL)animated
@@ -145,7 +152,8 @@
NSIndexPath *selected = [self.tableView indexPathForSelectedRow];
if (selected){
// Trigger a cell refresh
[self tableView:self.tableView cellForRowAtIndexPath:selected];
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:selected];
[self updateFormRow:rowDescriptor];
[self.tableView selectRowAtIndexPath:selected animated:NO scrollPosition:UITableViewScrollPositionNone];
[self.tableView deselectRowAtIndexPath:selected animated:YES];
}
@@ -157,7 +165,7 @@
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
@@ -198,7 +206,7 @@
+(NSMutableDictionary *)cellClassesForRowDescriptorTypes
{
static NSMutableDictionary * _cellClassesForRowDescriptorTypes;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_cellClassesForRowDescriptorTypes = [@{XLFormRowDescriptorTypeText:[XLFormTextFieldCell class],
@@ -212,6 +220,7 @@
XLFormRowDescriptorTypeNumber: [XLFormTextFieldCell class],
XLFormRowDescriptorTypeInteger: [XLFormTextFieldCell class],
XLFormRowDescriptorTypeDecimal: [XLFormTextFieldCell class],
XLFormRowDescriptorTypeZipCode: [XLFormTextFieldCell class],
XLFormRowDescriptorTypeSelectorPush: [XLFormSelectorCell class],
XLFormRowDescriptorTypeSelectorPopover: [XLFormSelectorCell class],
XLFormRowDescriptorTypeSelectorActionSheet: [XLFormSelectorCell class],
@@ -221,6 +230,7 @@
XLFormRowDescriptorTypeSelectorSegmentedControl: [XLFormSegmentedCell class],
XLFormRowDescriptorTypeMultipleSelector: [XLFormSelectorCell class],
XLFormRowDescriptorTypeMultipleSelectorPopover: [XLFormSelectorCell class],
XLFormRowDescriptorTypeImage: [XLFormImageCell class],
XLFormRowDescriptorTypeTextView: [XLFormTextViewCell class],
XLFormRowDescriptorTypeButton: [XLFormButtonCell class],
XLFormRowDescriptorTypeInfo: [XLFormSelectorCell class],
@@ -249,14 +259,15 @@
+(NSMutableDictionary *)inlineRowDescriptorTypesForRowDescriptorTypes
{
static NSMutableDictionary * _inlineRowDescriptorTypesForRowDescriptorTypes;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_inlineRowDescriptorTypesForRowDescriptorTypes = [
@{XLFormRowDescriptorTypeSelectorPickerViewInline: XLFormRowDescriptorTypePicker,
XLFormRowDescriptorTypeDateInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeDateTimeInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeTimeInline: XLFormRowDescriptorTypeDatePicker
XLFormRowDescriptorTypeTimeInline: XLFormRowDescriptorTypeDatePicker,
XLFormRowDescriptorTypeCountDownTimerInline: XLFormRowDescriptorTypeDatePicker
} mutableCopy];
});
return _inlineRowDescriptorTypesForRowDescriptorTypes;
@@ -304,7 +315,8 @@
}
}
-(void)updateAfterDependentRowChanged:(XLFormRowDescriptor *)formRow{
-(void)updateAfterDependentRowChanged:(XLFormRowDescriptor *)formRow
{
NSMutableArray* revaluateHidden = self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeHidden]];
NSMutableArray* revaluateDisabled = self.form.rowObservers[[formRow.tag formKeyForPredicateType:XLPredicateTypeDisabled]];
for (id object in revaluateDisabled) {
@@ -383,6 +395,9 @@
if ((self.form.rowNavigationOptions & XLFormRowNavigationOptionEnabled) != XLFormRowNavigationOptionEnabled){
return nil;
}
if ([[[[self class] inlineRowDescriptorTypesForRowDescriptorTypes] allKeys] containsObject:rowDescriptor.rowType]) {
return nil;
}
UITableViewCell<XLFormDescriptorCell> * cell = (UITableViewCell<XLFormDescriptorCell> *)[rowDescriptor cellForFormController:self];
if (![cell formDescriptorCellCanBecomeFirstResponder]){
return nil;
@@ -432,6 +447,15 @@
}
}
-(void)ensureRowIsVisible:(XLFormRowDescriptor *)inlineRowDescriptor
{
XLFormBaseCell * inlineCell = [inlineRowDescriptor cellForFormController:self];
NSIndexPath * indexOfOutOfWindowCell = [self.form indexPathOfFormRow:inlineRowDescriptor];
if(!inlineCell.window || (self.tableView.contentOffset.y + self.tableView.frame.size.height <= inlineCell.frame.origin.y + inlineCell.frame.size.height)){
[self.tableView scrollToRowAtIndexPath:indexOfOutOfWindowCell atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
}
#pragma mark - Methods
-(NSArray *)formValidationErrors
@@ -441,8 +465,32 @@
-(void)showFormValidationError:(NSError *)error
{
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil) message:error.localizedDescription delegate:self cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil];
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 80000
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
message:error.localizedDescription
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertView show];
#else
if ([UIAlertController class]){
UIAlertController * alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
else{
UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"XLFormViewController_ValidationErrorTitle", nil)
message:error.localizedDescription
delegate:self
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil];
[alertView show];
}
#endif
}
-(void)performFormSelector:(SEL)selector withObject:(id)sender
@@ -469,11 +517,12 @@
UITableViewCell<XLFormDescriptorCell> * cell = [firstResponderView formDescriptorCell];
if (cell){
NSDictionary *keyboardInfo = [notification userInfo];
CGRect keyboardFrame = [self.tableView.window convertRect:[keyboardInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue] toView:self.tableView.superview];
CGFloat newBottomInset = self.tableView.frame.origin.y + self.tableView.frame.size.height - keyboardFrame.origin.y;
if (newBottomInset > 0){
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
_keyboardFrame = [self.tableView.window convertRect:[keyboardInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue] toView:self.tableView.superview];
CGFloat newBottomInset = self.tableView.frame.origin.y + self.tableView.frame.size.height - _keyboardFrame.origin.y;
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
_oldBottomTableContentInset = _oldBottomTableContentInset ?: @(tableContentInset.bottom);
if (newBottomInset > [_oldBottomTableContentInset floatValue]){
tableContentInset.bottom = newBottomInset;
tableScrollIndicatorInsets.bottom = tableContentInset.bottom;
[UIView beginAnimations:nil context:nil];
@@ -493,11 +542,13 @@
UIView * firstResponderView = [self.tableView findFirstResponder];
UITableViewCell<XLFormDescriptorCell> * cell = [firstResponderView formDescriptorCell];
if (cell){
_keyboardFrame = CGRectZero;
NSDictionary *keyboardInfo = [notification userInfo];
UIEdgeInsets tableContentInset = self.tableView.contentInset;
UIEdgeInsets tableScrollIndicatorInsets = self.tableView.scrollIndicatorInsets;
tableContentInset.bottom = 0;
tableContentInset.bottom = [_oldBottomTableContentInset floatValue];
tableScrollIndicatorInsets.bottom = tableContentInset.bottom;
_oldBottomTableContentInset = nil;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:[keyboardInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]];
[UIView setAnimationCurve:[keyboardInfo[UIKeyboardAnimationCurveUserInfoKey] intValue]];
@@ -529,6 +580,7 @@
{
XLFormBaseCell * cell = [formRow cellForFormController:self];
cell.rowDescriptor = formRow;
[cell setNeedsUpdateConstraints];
[cell setNeedsLayout];
return cell;
}
@@ -552,7 +604,13 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:indexPath];
return [self updateFormRow:rowDescriptor];
return [rowDescriptor cellForFormController:self];
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
XLFormRowDescriptor * rowDescriptor = [self.form formRowAtIndex:indexPath];
[self updateFormRow:rowDescriptor];
}
@@ -599,7 +657,7 @@
self.tableView.editing = !self.tableView.editing;
self.tableView.editing = !self.tableView.editing;
});
}
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
@@ -734,7 +792,7 @@
return [NSIndexPath indexPathForRow:proposedDestinationIndexPath.row - 1 inSection:sourceIndexPath.section];
}
}
if ((sectionDescriptor.sectionInsertMode == XLFormSectionInsertModeButton && sectionDescriptor.sectionOptions & XLFormSectionOptionCanInsert)){
if (proposedDestinationIndexPath.row == sectionDescriptor.formRows.count - 1){
return [NSIndexPath indexPathForRow:(sectionDescriptor.formRows.count - 2) inSection:sourceIndexPath.section];
@@ -791,9 +849,17 @@
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
UITableViewCell<XLFormDescriptorCell>* cell = textField.formDescriptorCell;
XLFormRowDescriptor * nextRow = [self nextRowDescriptorForRow:textField.formDescriptorCell.rowDescriptor
withDirection:XLFormRowNavigationDirectionNext];
textField.returnKeyType = nextRow ? UIReturnKeyNext : UIReturnKeyDefault;
if ([cell conformsToProtocol:@protocol(XLFormReturnKeyProtocol)]) {
textField.returnKeyType = nextRow ? ((id<XLFormReturnKeyProtocol>)cell).nextReturnKeyType : ((id<XLFormReturnKeyProtocol>)cell).returnKeyType;
}
else {
textField.returnKeyType = nextRow ? UIReturnKeyNext : UIReturnKeyDefault;
}
return YES;
}
@@ -888,10 +954,7 @@
UITableViewCell<XLFormDescriptorCell> * cell = (UITableViewCell<XLFormDescriptorCell> *)[nextRow cellForFormController:self];
if ([cell formDescriptorCellCanBecomeFirstResponder]){
NSIndexPath * indexPath = [self.form indexPathOfFormRow:nextRow];
[self.tableView beginUpdates];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:NO];
[self.tableView endUpdates];
[cell formDescriptorCellBecomeFirstResponder];
}
}
@@ -933,9 +996,14 @@
-(void)setForm:(XLFormDescriptor *)form
{
_form.delegate = nil;
[self.tableView endEditing:YES];
_form = form;
_form.delegate = self;
[_form forceEvaluate];
if ([self isViewLoaded]){
[self.tableView reloadData];
}
}
-(XLFormDescriptor *)form
+28 -29
View File
@@ -28,8 +28,8 @@
#import "XLFormDescriptorDelegate.h"
#import <Foundation/Foundation.h>
extern NSString * const XLFormErrorDomain;
extern NSString * const XLValidationStatusErrorKey;
extern NSString * __nonnull const XLFormErrorDomain;
extern NSString * __nonnull const XLValidationStatusErrorKey;
typedef NS_ENUM(NSInteger, XLFormErrorCode)
{
@@ -49,46 +49,45 @@ typedef NS_OPTIONS(NSUInteger, XLFormRowNavigationOptions) {
@interface XLFormDescriptor : NSObject
@property (readonly, nonatomic) NSMutableArray * formSections;
@property (readonly) NSString * title;
@property (readonly, nonatomic, nonnull) NSMutableArray * formSections;
@property (readonly, nullable) NSString * title;
@property (nonatomic) BOOL assignFirstResponderOnShow;
@property (nonatomic) BOOL addAsteriskToRequiredRowsTitle;
@property (getter=isDisabled) BOOL disabled;
@property (nonatomic) XLFormRowNavigationOptions rowNavigationOptions;
@property (weak) id<XLFormDescriptorDelegate> delegate;
@property (weak, nullable) id<XLFormDescriptorDelegate> delegate;
-(instancetype)initWithTitle:(NSString *)title;
+(instancetype)formDescriptor;
+(instancetype)formDescriptorWithTitle:(NSString *)title;
+(nonnull instancetype)formDescriptor;
+(nonnull instancetype)formDescriptorWithTitle:(nullable NSString *)title;
-(void)addFormSection:(XLFormSectionDescriptor *)formSection;
-(void)addFormSection:(XLFormSectionDescriptor *)formSection atIndex:(NSUInteger)index;
-(void)addFormSection:(XLFormSectionDescriptor *)formSection afterSection:(XLFormSectionDescriptor *)afterSection;
-(void)addFormRow:(XLFormRowDescriptor *)formRow beforeRow:(XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(XLFormRowDescriptor *)formRow beforeRowTag:(NSString *)afterRowTag;
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRow:(XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRowTag:(NSString *)afterRowTag;
-(void)addFormSection:(nonnull XLFormSectionDescriptor *)formSection;
-(void)addFormSection:(nonnull XLFormSectionDescriptor *)formSection atIndex:(NSUInteger)index;
-(void)addFormSection:(nonnull XLFormSectionDescriptor *)formSection afterSection:(nonnull XLFormSectionDescriptor *)afterSection;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow beforeRow:(nonnull XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow beforeRowTag:(nonnull NSString *)afterRowTag;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow afterRow:(nonnull XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow afterRowTag:(nonnull NSString *)afterRowTag;
-(void)removeFormSectionAtIndex:(NSUInteger)index;
-(void)removeFormSection:(XLFormSectionDescriptor *)formSection;
-(void)removeFormRow:(XLFormRowDescriptor *)formRow;
-(void)removeFormRowWithTag:(NSString *)tag;
-(void)removeFormSection:(nonnull XLFormSectionDescriptor *)formSection;
-(void)removeFormRow:(nonnull XLFormRowDescriptor *)formRow;
-(void)removeFormRowWithTag:(nonnull NSString *)tag;
-(XLFormRowDescriptor *)formRowWithTag:(NSString *)tag;
-(XLFormRowDescriptor *)formRowAtIndex:(NSIndexPath *)indexPath;
-(XLFormRowDescriptor *)formRowWithHash:(NSUInteger)hash;
-(XLFormSectionDescriptor *)formSectionAtIndex:(NSUInteger)index;
-(nullable XLFormRowDescriptor *)formRowWithTag:(nonnull NSString *)tag;
-(nullable XLFormRowDescriptor *)formRowAtIndex:(nonnull NSIndexPath *)indexPath;
-(nullable XLFormRowDescriptor *)formRowWithHash:(NSUInteger)hash;
-(nullable XLFormSectionDescriptor *)formSectionAtIndex:(NSUInteger)index;
-(NSIndexPath *)indexPathOfFormRow:(XLFormRowDescriptor *)formRow;
-(nullable NSIndexPath *)indexPathOfFormRow:(nonnull XLFormRowDescriptor *)formRow;
-(NSDictionary *)formValues;
-(NSDictionary *)httpParameters:(XLFormViewController *)formViewController;
-(nonnull NSDictionary *)formValues;
-(nonnull NSDictionary *)httpParameters:(nonnull XLFormViewController *)formViewController;
-(NSArray *)localValidationErrors:(XLFormViewController *)formViewController;
- (void)setFirstResponder:(XLFormViewController *)formViewController;
-(nonnull NSArray *)localValidationErrors:(nonnull XLFormViewController *)formViewController;
-(void)setFirstResponder:(nonnull XLFormViewController *)formViewController;
-(XLFormRowDescriptor *)nextRowDescriptorForRow:(XLFormRowDescriptor *)currentRow;
-(XLFormRowDescriptor *)previousRowDescriptorForRow:(XLFormRowDescriptor *)currentRow;
-(nullable XLFormRowDescriptor *)nextRowDescriptorForRow:(nonnull XLFormRowDescriptor *)currentRow;
-(nullable XLFormRowDescriptor *)previousRowDescriptorForRow:(nonnull XLFormRowDescriptor *)currentRow;
-(void)forceEvaluate;
+4 -4
View File
@@ -85,12 +85,12 @@ NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
+(instancetype)formDescriptor
{
return [self formDescriptorWithTitle:nil];
return [[self class] formDescriptorWithTitle:nil];
}
+(instancetype)formDescriptorWithTitle:(NSString *)title
{
return [[XLFormDescriptor alloc] initWithTitle:title];
return [[[self class] alloc] initWithTitle:title];
}
-(void)addFormSection:(XLFormSectionDescriptor *)formSection
@@ -501,7 +501,7 @@ NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
{
NSUInteger indexOfRow = [row.sectionDescriptor.formRows indexOfObject:row];
if (indexOfRow != NSNotFound){
if ([row.sectionDescriptor.formRows indexOfObject:row] + 1 < row.sectionDescriptor.formRows.count){
if (indexOfRow + 1 < row.sectionDescriptor.formRows.count){
return [row.sectionDescriptor.formRows objectAtIndex:++indexOfRow];
}
else{
@@ -525,7 +525,7 @@ NSString * const XLValidationStatusErrorKey = @"XLValidationStatusErrorKey";
{
NSUInteger indexOfRow = [row.sectionDescriptor.formRows indexOfObject:row];
if (indexOfRow != NSNotFound){
if ([row.sectionDescriptor.formRows indexOfObject:row] > 0 ){
if (indexOfRow > 0 ){
return [row.sectionDescriptor.formRows objectAtIndex:--indexOfRow];
}
else{
+50 -45
View File
@@ -41,56 +41,61 @@ typedef NS_ENUM(NSUInteger, XLFormPresentationMode) {
XLFormPresentationModePresent
};
typedef void(^XLOnChangeBlock)(id __nullable oldValue,id __nullable newValue,XLFormRowDescriptor* __nonnull rowDescriptor);
@interface XLFormRowDescriptor : NSObject
@property id cellClass;
@property (readwrite) NSString *tag;
@property (readonly) NSString *rowType;
@property NSString *title;
@property (nonatomic) id value;
@property Class valueTransformer;
@property (nullable) id cellClass;
@property (readwrite, nullable) NSString * tag;
@property (readonly, nonnull) NSString * rowType;
@property (nullable) NSString * title;
@property (nonatomic, nullable) id value;
@property (nullable) Class valueTransformer;
@property UITableViewCellStyle cellStyle;
@property (nonatomic) NSMutableDictionary *cellConfig;
@property (nonatomic) NSMutableDictionary *cellConfigIfDisabled;
@property (nonatomic) NSMutableDictionary *cellConfigAtConfigure;
@property (copy, nullable) XLOnChangeBlock onChangeBlock;
@property id disabled;
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfig;
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfigIfDisabled;
@property (nonatomic, readonly, nonnull) NSMutableDictionary * cellConfigAtConfigure;
@property (nonnull) id disabled;
-(BOOL)isDisabled;
@property id hidden;
@property (nonnull) id hidden;
-(BOOL)isHidden;
@property (getter=isRequired) BOOL required;
@property XLFormAction * action;
@property (nonnull) XLFormAction * action;
@property (weak) XLFormSectionDescriptor * sectionDescriptor;
@property (weak, null_unspecified) XLFormSectionDescriptor * sectionDescriptor;
+(instancetype)formRowDescriptorWithTag:(NSString *)tag rowType:(NSString *)rowType;
+(instancetype)formRowDescriptorWithTag:(NSString *)tag rowType:(NSString *)rowType title:(NSString *)title;
+(nonnull instancetype)formRowDescriptorWithTag:(nullable NSString *)tag rowType:(nonnull NSString *)rowType;
+(nonnull instancetype)formRowDescriptorWithTag:(nullable NSString *)tag rowType:(nonnull NSString *)rowType title:(nullable NSString *)title;
-(nonnull instancetype)initWithTag:(nullable NSString *)tag rowType:(nonnull NSString *)rowType title:(nullable NSString *)title;
-(XLFormBaseCell *)cellForFormController:(XLFormViewController *)formController;
-(nonnull XLFormBaseCell *)cellForFormController:(nonnull XLFormViewController *)formController;
@property NSString *requireMsg;
-(void)addValidator:(id<XLFormValidatorProtocol>)validator;
-(void)removeValidator:(id<XLFormValidatorProtocol>)validator;
-(XLFormValidationStatus *)doValidation;
@property (nullable) NSString *requireMsg;
-(void)addValidator:(nonnull id<XLFormValidatorProtocol>)validator;
-(void)removeValidator:(nonnull id<XLFormValidatorProtocol>)validator;
-(nonnull XLFormValidationStatus *)doValidation;
// ===========================
// property used for Selectors
// ===========================
@property NSString * noValueDisplayText;
@property NSString * selectorTitle;
@property NSArray * selectorOptions;
@property (nullable) NSString * noValueDisplayText;
@property (nullable) NSString * selectorTitle;
@property (nullable) NSArray * selectorOptions;
@property id leftRightSelectorLeftOptionSelected;
@property (null_unspecified) id leftRightSelectorLeftOptionSelected;
// =====================================
// Deprecated
// =====================================
@property Class buttonViewController DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use action.viewControllerClass instead");
@property (null_unspecified) Class buttonViewController DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use action.viewControllerClass instead");
@property XLFormPresentationMode buttonViewControllerPresentationMode DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("use action.viewControllerPresentationMode instead");
@property Class selectorControllerClass DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use action.viewControllerClass instead");
@property (null_unspecified) Class selectorControllerClass DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use action.viewControllerClass instead");
@end
@@ -101,18 +106,18 @@ typedef NS_ENUM(NSUInteger, XLFormPresentationMode) {
// =====================================
@interface XLFormLeftRightSelectorOption : NSObject
@property (readonly) id leftValue;
@property (readonly) NSArray * rightOptions;
@property (readonly) NSString * httpParameterKey;
@property Class rightSelectorControllerClass;
@property (readonly, nonnull) id leftValue;
@property (readonly, nonnull) NSArray * rightOptions;
@property (readonly, null_unspecified) NSString * httpParameterKey;
@property (nullable) Class rightSelectorControllerClass;
@property NSString * noValueDisplayText;
@property NSString * selectorTitle;
@property (nullable) NSString * noValueDisplayText;
@property (nullable) NSString * selectorTitle;
+(XLFormLeftRightSelectorOption *)formLeftRightSelectorOptionWithLeftValue:(id)leftValue
httpParameterKey:(NSString *)httpParameterKey
rightOptions:(NSArray *)rightOptions;
+(nonnull XLFormLeftRightSelectorOption *)formLeftRightSelectorOptionWithLeftValue:(nonnull id)leftValue
httpParameterKey:(null_unspecified NSString *)httpParameterKey
rightOptions:(nonnull NSArray *)rightOptions;
@end
@@ -122,23 +127,23 @@ typedef NS_ENUM(NSUInteger, XLFormPresentationMode) {
@required
-(NSString *)formDisplayText;
-(id)formValue;
-(nonnull NSString *)formDisplayText;
-(nonnull id)formValue;
@end
@interface XLFormAction : NSObject
@property (nonatomic, strong) Class viewControllerClass;
@property (nonatomic, strong) NSString * viewControllerStoryboardId;
@property (nonatomic, strong) NSString * viewControllerNibName;
@property (nullable, nonatomic, strong) Class viewControllerClass;
@property (nullable, nonatomic, strong) NSString * viewControllerStoryboardId;
@property (nullable, nonatomic, strong) NSString * viewControllerNibName;
@property (nonatomic) XLFormPresentationMode viewControllerPresentationMode;
@property (nonatomic, strong) void (^formBlock)(XLFormRowDescriptor * sender);
@property (nonatomic) SEL formSelector;
@property (nonatomic, strong) NSString * formSegueIdenfifier;
@property (nonatomic, strong) Class formSegueClass;
@property (nullable, nonatomic, strong) void (^formBlock)(XLFormRowDescriptor * __nonnull sender);
@property (nullable, nonatomic) SEL formSelector;
@property (nullable, nonatomic, strong) NSString * formSegueIdenfifier DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use formSegueIdentifier instead");
@property (nullable, nonatomic, strong) NSString * formSegueIdentifier;
@property (nullable, nonatomic, strong) Class formSegueClass;
@end
+70 -28
View File
@@ -63,7 +63,9 @@
@synthesize hidden = _hidden;
@synthesize hidePredicateCache = _hidePredicateCache;
@synthesize disablePredicateCache = _disablePredicateCache;
@synthesize cellConfig = _cellConfig;
@synthesize cellConfigIfDisabled = _cellConfigIfDisabled;
@synthesize cellConfigAtConfigure = _cellConfigAtConfigure;
-(instancetype)init
{
@@ -80,7 +82,7 @@
_hidden = @NO;
_rowType = rowType;
_title = title;
_cellStyle = UITableViewCellStyleValue1;
_cellStyle = [rowType isEqualToString:XLFormRowDescriptorTypeButton] ? UITableViewCellStyleDefault : UITableViewCellStyleValue1;
_validators = [NSMutableArray new];
_cellConfig = [NSMutableDictionary dictionary];
_cellConfigIfDisabled = [NSMutableDictionary dictionary];
@@ -92,28 +94,45 @@
[self addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
[self addObserver:self forKeyPath:@"disablePredicateCache" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
[self addObserver:self forKeyPath:@"hidePredicateCache" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:0];
}
return self;
}
+(instancetype)formRowDescriptorWithTag:(NSString *)tag rowType:(NSString *)rowType
{
return [XLFormRowDescriptor formRowDescriptorWithTag:tag rowType:rowType title:nil];
return [[self class] formRowDescriptorWithTag:tag rowType:rowType title:nil];
}
+(instancetype)formRowDescriptorWithTag:(NSString *)tag rowType:(NSString *)rowType title:(NSString *)title
{
return [[XLFormRowDescriptor alloc] initWithTag:tag rowType:rowType title:title];
return [[[self class] alloc] initWithTag:tag rowType:rowType title:title];
}
-(XLFormBaseCell *)cellForFormController:(XLFormViewController *)formController
-(XLFormBaseCell *)cellForFormController:(XLFormViewController * __unused)formController
{
if (!_cell){
id cellClass = self.cellClass ?: [XLFormViewController cellClassesForRowDescriptorTypes][self.rowType];
NSAssert(cellClass, @"Not defined XLFormRowDescriptorType: %@", self.rowType ?: @"");
if ([cellClass isKindOfClass:[NSString class]]) {
if ([[NSBundle mainBundle] pathForResource:cellClass ofType:@"nib"]){
_cell = [[[NSBundle mainBundle] loadNibNamed:cellClass owner:nil options:nil] firstObject];
NSString *cellClassString = cellClass;
NSString *cellResource = nil;
NSBundle *bundle = nil;
if ([cellClassString containsString:@"/"]) {
NSArray *components = [cellClassString componentsSeparatedByString:@"/"];
cellResource = [components lastObject];
NSString *folderName = [components firstObject];
NSString *bundlePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:folderName];
bundle = [NSBundle bundleWithPath:bundlePath];
} else {
bundle = [NSBundle bundleForClass:NSClassFromString(cellClass)];
cellResource = cellClassString;
}
NSParameterAssert(bundle != nil);
NSParameterAssert(cellResource != nil);
if ([bundle pathForResource:cellResource ofType:@"nib"]){
_cell = [[bundle loadNibNamed:cellResource owner:nil options:nil] firstObject];
}
} else {
_cell = [[cellClass alloc] initWithStyle:self.cellStyle reuseIdentifier:nil];
@@ -175,29 +194,30 @@
{
XLFormRowDescriptor * rowDescriptorCopy = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:[self.rowType copy] title:[self.title copy]];
rowDescriptorCopy.cellClass = [self.cellClass copy];
rowDescriptorCopy.cellConfig = [self.cellConfig mutableCopy];
rowDescriptorCopy.cellConfigAtConfigure = [self.cellConfigAtConfigure mutableCopy];
[rowDescriptorCopy.cellConfig addEntriesFromDictionary:self.cellConfig];
[rowDescriptorCopy.cellConfigAtConfigure addEntriesFromDictionary:self.cellConfigAtConfigure];
rowDescriptorCopy.valueTransformer = [self.valueTransformer copy];
rowDescriptorCopy->_hidden = _hidden;
rowDescriptorCopy->_disabled = _disabled;
rowDescriptorCopy.required = self.isRequired;
rowDescriptorCopy.isDirtyDisablePredicateCache = YES;
rowDescriptorCopy.isDirtyHidePredicateCache = YES;
// =====================
// properties for Button
// =====================
rowDescriptorCopy.action = [self.action copy];
// ===========================
// property used for Selectors
// ===========================
rowDescriptorCopy.noValueDisplayText = [self.noValueDisplayText copy];
rowDescriptorCopy.selectorTitle = [self.selectorTitle copy];
rowDescriptorCopy.selectorOptions = [self.selectorOptions copy];
rowDescriptorCopy.leftRightSelectorLeftOptionSelected = [self.leftRightSelectorLeftOptionSelected copy];
return rowDescriptorCopy;
}
@@ -230,6 +250,9 @@
id oldValue = [change objectForKey:NSKeyValueChangeOldKey];
if ([keyPath isEqualToString:@"value"]){
[self.sectionDescriptor.formDescriptor.delegate formRowDescriptorValueHasChanged:object oldValue:oldValue newValue:newValue];
if (self.onChangeBlock) {
self.onChangeBlock(oldValue, newValue, self);
}
}
else{
[self.sectionDescriptor.formDescriptor.delegate formRowDescriptorPredicateHasChanged:object oldValue:oldValue newValue:newValue predicateType:([keyPath isEqualToString:@"hidePredicateCache"] ? XLPredicateTypeHidden : XLPredicateTypeDisabled)];
@@ -260,7 +283,7 @@
if ([_disabled isKindOfClass:[NSPredicate class]]){
[self.sectionDescriptor.formDescriptor addObserversOfObject:self predicateType:XLPredicateTypeDisabled];
}
[self evaluateIsDisabled];
}
@@ -278,6 +301,9 @@
else{
self.disablePredicateCache = _disabled;
}
if ([self.disablePredicateCache boolValue]){
[self.cell resignFirstResponder];
}
return [self.disablePredicateCache boolValue];
}
@@ -338,7 +364,13 @@
else{
self.hidePredicateCache = _hidden;
}
[self.hidePredicateCache boolValue] ? [self.sectionDescriptor hideFormRow:self] : [self.sectionDescriptor showFormRow:self];
if ([self.hidePredicateCache boolValue]){
[self.cell resignFirstResponder];
[self.sectionDescriptor hideFormRow:self];
}
else{
[self.sectionDescriptor showFormRow:self];
}
return [self.hidePredicateCache boolValue];
}
@@ -367,7 +399,7 @@
{
if (validator == nil || ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)])
return;
if(![self.validators containsObject:validator]) {
[self.validators addObject:validator];
}
@@ -377,7 +409,7 @@
{
if (validator == nil|| ![validator conformsToProtocol:@protocol(XLFormValidatorProtocol)])
return;
if ([self.validators containsObject:validator]) {
[self.validators removeObject:validator];
}
@@ -391,7 +423,7 @@
-(XLFormValidationStatus *)doValidation
{
XLFormValidationStatus *valStatus = nil;
if (self.required) {
// do required validation here
if ([self valueIsEmpty]) {
@@ -403,7 +435,7 @@
// default message for required msg
msg = NSLocalizedString(@"%@ can't be empty", nil);
}
if (self.title != nil) {
valStatus.msg = [NSString stringWithFormat:msg, self.title];
} else {
@@ -525,8 +557,8 @@
else if (self.formSelector){
actionCopy.formSelector = self.formSelector;
}
else if (self.formSegueIdenfifier){
actionCopy.formSegueIdenfifier = [self.formSegueIdenfifier copy];
else if (self.formSegueIdentifier){
actionCopy.formSegueIdentifier = [self.formSegueIdentifier copy];
}
else if (self.formSegueClass){
actionCopy.formSegueClass = [self.formSegueClass copy];
@@ -560,7 +592,7 @@
{
_formBlock = nil;
_formSegueClass = nil;
_formSegueIdenfifier = nil;
_formSegueIdentifier = nil;
_formSelector = formSelector;
}
@@ -568,7 +600,7 @@
-(void)setFormBlock:(void (^)(XLFormRowDescriptor *))formBlock
{
_formSegueClass = nil;
_formSegueIdenfifier = nil;
_formSegueIdentifier = nil;
_formSelector = nil;
_formBlock = formBlock;
}
@@ -577,17 +609,27 @@
{
_formSelector = nil;
_formBlock = nil;
_formSegueIdenfifier = nil;
_formSegueIdentifier = nil;
_formSegueClass = formSegueClass;
}
-(void)setFormSegueIdenfifier:(NSString *)formSegueIdenfifier
-(void)setFormSegueIdentifier:(NSString *)formSegueIdentifier
{
_formSelector = nil;
_formBlock = nil;
_formSegueClass = nil;
_formSegueIdenfifier = formSegueIdenfifier;
_formSegueIdentifier = formSegueIdentifier;
}
// Deprecated:
-(void)setFormSegueIdenfifier:(NSString *)formSegueIdenfifier
{
self.formSegueIdentifier = formSegueIdenfifier;
}
-(NSString *)formSegueIdenfifier
{
return self.formSegueIdentifier;
}
@end
+17 -17
View File
@@ -42,32 +42,32 @@ typedef NS_ENUM(NSUInteger, XLFormSectionInsertMode) {
@interface XLFormSectionDescriptor : NSObject
@property (nonatomic) NSString * title;
@property (nonatomic) NSString * footerTitle;
@property (readonly) NSMutableArray * formRows;
@property (nonatomic, nullable) NSString * title;
@property (nonatomic, nullable) NSString * footerTitle;
@property (readonly, nonnull) NSMutableArray * formRows;
@property (readonly) XLFormSectionInsertMode sectionInsertMode;
@property (readonly) XLFormSectionOptions sectionOptions;
@property XLFormRowDescriptor * multivaluedRowTemplate;
@property (readonly) XLFormRowDescriptor * multivaluedAddButton;
@property (nonatomic) NSString * multivaluedTag;
@property (nullable) XLFormRowDescriptor * multivaluedRowTemplate;
@property (readonly, nullable) XLFormRowDescriptor * multivaluedAddButton;
@property (nonatomic, nullable) NSString * multivaluedTag;
@property (weak) XLFormDescriptor * formDescriptor;
@property (weak, null_unspecified) XLFormDescriptor * formDescriptor;
@property id hidden;
@property (nonnull) id hidden;
-(BOOL)isHidden;
+(instancetype)formSection;
+(instancetype)formSectionWithTitle:(NSString *)title;
+(instancetype)formSectionWithTitle:(NSString *)title multivaluedSection:(BOOL)multivaluedSection DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use formSectionWithTitle:sectionType: instead");
+(instancetype)formSectionWithTitle:(NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions;
+(instancetype)formSectionWithTitle:(NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions sectionInsertMode:(XLFormSectionInsertMode)sectionInsertMode;
+(nonnull instancetype)formSection;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title multivaluedSection:(BOOL)multivaluedSection DEPRECATED_ATTRIBUTE DEPRECATED_MSG_ATTRIBUTE("Use formSectionWithTitle:sectionType: instead");
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions;
+(nonnull instancetype)formSectionWithTitle:(nullable NSString *)title sectionOptions:(XLFormSectionOptions)sectionOptions sectionInsertMode:(XLFormSectionInsertMode)sectionInsertMode;
-(BOOL)isMultivaluedSection;
-(void)addFormRow:(XLFormRowDescriptor *)formRow;
-(void)addFormRow:(XLFormRowDescriptor *)formRow afterRow:(XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(XLFormRowDescriptor *)formRow beforeRow:(XLFormRowDescriptor *)beforeRow;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow afterRow:(nonnull XLFormRowDescriptor *)afterRow;
-(void)addFormRow:(nonnull XLFormRowDescriptor *)formRow beforeRow:(nonnull XLFormRowDescriptor *)beforeRow;
-(void)removeFormRowAtIndex:(NSUInteger)index;
-(void)removeFormRow:(XLFormRowDescriptor *)formRow;
-(void)removeFormRow:(nonnull XLFormRowDescriptor *)formRow;
@end

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