diff --git a/Examples/Objective-C/Examples/CustomRows/CustomRowsViewController.m b/Examples/Objective-C/Examples/CustomRows/CustomRowsViewController.m index a8737385..b86e7c25 100644 --- a/Examples/Objective-C/Examples/CustomRows/CustomRowsViewController.m +++ b/Examples/Objective-C/Examples/CustomRows/CustomRowsViewController.m @@ -28,11 +28,13 @@ #import "XLFormRatingCell.h" #import "FloatLabeledTextFieldCell.h" #import "XLFormCustomCell.h" +#import "XLFormInlineSegmentedCell.h" static NSString * const kCustomRowFirstRatingTag = @"CustomRowFirstRatingTag"; static NSString * const kCustomRowSecondRatingTag = @"CustomRowSecondRatingTag"; static NSString * const kCustomRowFloatLabeledTextFieldTag = @"CustomRowFloatLabeledTextFieldTag"; static NSString * const kCustomRowWeekdays = @"CustomRowWeekdays"; +static NSString * const kCustomInline = @"kCustomInline"; static NSString * const kCustomRowText = @"kCustomText"; @implementation CustomRowsViewController @@ -94,6 +96,16 @@ -(void)initializeForm }; [section addFormRow:row]; + // Custom Inline Segmented row + section = [XLFormSectionDescriptor formSectionWithTitle:@"Custom Inline"]; + [form addFormSection:section]; + + // Inline segmented + row = [XLFormRowDescriptor formRowDescriptorWithTag:kCustomInline rowType:XLFormRowDescriptorTypeSegmentedInline]; + row.title = @"You support..."; + row.selectorOptions = @[@"Uruguay", @"Brazil", @"Argentina", @"Chile"]; + row.value = @"Uruguay"; + [section addFormRow:row]; section = [XLFormSectionDescriptor formSection]; [form addFormSection:section]; diff --git a/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.h b/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.h new file mode 100644 index 00000000..ace9a4a3 --- /dev/null +++ b/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.h @@ -0,0 +1,22 @@ +// +// XLFormInlineSegmentedCell.h +// XLForm +// +// Created by mathias Claassen on 16/12/15. +// Copyright © 2015 Xmartlabs. All rights reserved. +// + +#import + +extern NSString * const XLFormRowDescriptorTypeSegmentedInline; +extern NSString * const XLFormRowDescriptorTypeSegmentedControl; + +@interface XLFormInlineSegmentedCell : XLFormBaseCell + +@end + + +@interface XLFormInlineSegmentedControl : XLFormBaseCell + +@property (strong, nonatomic) UISegmentedControl* segmentedControl; +@end \ No newline at end of file diff --git a/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.m b/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.m new file mode 100644 index 00000000..767d7adc --- /dev/null +++ b/Examples/Objective-C/Inline Segmented/XLFormInlineSegmentedCell.m @@ -0,0 +1,194 @@ +// +// XLFormInlineSegmentedCell.m +// XLForm +// +// Created by mathias Claassen on 16/12/15. +// Copyright © 2015 Xmartlabs. All rights reserved. +// + +#import "XLFormInlineSegmentedCell.h" + +NSString * const XLFormRowDescriptorTypeSegmentedInline = @"XLFormRowDescriptorTypeSegmentedInline"; +NSString * const XLFormRowDescriptorTypeSegmentedControl = @"XLFormRowDescriptorTypeSegmentedControl"; + +@implementation XLFormInlineSegmentedCell + ++(void)load +{ + [XLFormViewController.cellClassesForRowDescriptorTypes setObject:[XLFormInlineSegmentedCell class] forKey:XLFormRowDescriptorTypeSegmentedInline]; + [XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes setObject:XLFormRowDescriptorTypeSegmentedControl forKey:XLFormRowDescriptorTypeSegmentedInline]; +} + +- (BOOL)canBecomeFirstResponder +{ + return YES; +} + +-(BOOL)becomeFirstResponder +{ + if (self.isFirstResponder){ + return [super becomeFirstResponder]; + } + BOOL result = [super becomeFirstResponder]; + if (result){ + XLFormRowDescriptor * inlineRowDescriptor = [XLFormRowDescriptor formRowDescriptorWithTag:nil rowType:[XLFormViewController inlineRowDescriptorTypesForRowDescriptorTypes][self.rowDescriptor.rowType]]; + UITableViewCell * cell = [inlineRowDescriptor cellForFormController:self.formViewController]; + NSAssert([cell conformsToProtocol:@protocol(XLFormInlineRowDescriptorCell)], @"inline cell must conform to XLFormInlineRowDescriptorCell"); + UITableViewCell * inlineCell = (UITableViewCell *)cell; + inlineCell.inlineRowDescriptor = self.rowDescriptor; + [self.rowDescriptor.sectionDescriptor addFormRow:inlineRowDescriptor afterRow:self.rowDescriptor]; + [self.formViewController ensureRowIsVisible:inlineRowDescriptor]; + } + return result; +} + +-(BOOL)resignFirstResponder +{ + if (![self isFirstResponder]) { + return [super resignFirstResponder]; + } + NSIndexPath * selectedRowPath = [self.formViewController.form indexPathOfFormRow:self.rowDescriptor]; + NSIndexPath * nextRowPath = [NSIndexPath indexPathForRow:selectedRowPath.row + 1 inSection:selectedRowPath.section]; + XLFormRowDescriptor * nextFormRow = [self.formViewController.form formRowAtIndex:nextRowPath]; + XLFormSectionDescriptor * formSection = [self.formViewController.form.formSections objectAtIndex:nextRowPath.section]; + BOOL result = [super resignFirstResponder]; + if (result) { + [formSection removeFormRow:nextFormRow]; + } + return result; +} + + +#pragma mark - XLFormDescriptorCell + +-(void)configure +{ + [super configure]; +} + +-(void)update +{ + [super update]; + self.accessoryType = UITableViewCellAccessoryNone; + self.editingAccessoryType = UITableViewCellAccessoryNone; + [self.textLabel setText:self.rowDescriptor.title]; + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.detailTextLabel.text = [self valueDisplayText]; +} + +-(BOOL)formDescriptorCellCanBecomeFirstResponder +{ + return !(self.rowDescriptor.isDisabled); +} + +-(BOOL)formDescriptorCellBecomeFirstResponder +{ + + if ([self isFirstResponder]){ + [self resignFirstResponder]; + return NO; + } + return [self becomeFirstResponder]; +} + +-(void)formDescriptorCellDidSelectedWithFormController:(XLFormViewController *)controller +{ + [controller.tableView deselectRowAtIndexPath:[controller.form indexPathOfFormRow:self.rowDescriptor] animated:YES]; +} + +#pragma mark - Helpers + +-(NSString *)valueDisplayText +{ + return (self.rowDescriptor.value ? [self.rowDescriptor.value displayText] : self.rowDescriptor.noValueDisplayText); +} + + + +@end + + + + +@implementation XLFormInlineSegmentedControl + +@synthesize segmentedControl = _segmentedControl; +@synthesize inlineRowDescriptor = _inlineRowDescriptor; + + ++(void)load +{ + [XLFormViewController.cellClassesForRowDescriptorTypes setObject:[XLFormInlineSegmentedControl class] forKey:XLFormRowDescriptorTypeSegmentedControl]; +} + +-(void)configure +{ + [super configure]; + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self.contentView addSubview:self.segmentedControl]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[segmentedControl]-|" + options:NSLayoutFormatAlignAllCenterY + metrics:0 + views:@{@"segmentedControl": self.segmentedControl}]]; + [self.segmentedControl addTarget:self action:@selector(valueChanged) forControlEvents:UIControlEventValueChanged]; +} + +-(void)update +{ + [super update]; + [self updateSegmentedControl]; + self.segmentedControl.selectedSegmentIndex = [self selectedIndex]; + self.segmentedControl.enabled = !self.rowDescriptor.isDisabled; +} + +-(UISegmentedControl *)segmentedControl +{ + if (_segmentedControl) return _segmentedControl; + + _segmentedControl = [UISegmentedControl autolayoutView]; + [_segmentedControl setContentHuggingPriority:500 forAxis:UILayoutConstraintAxisHorizontal]; + return _segmentedControl; +} + + +#pragma mark - Action + +-(void)valueChanged +{ + self.inlineRowDescriptor.value = [self.inlineRowDescriptor.selectorOptions objectAtIndex:self.segmentedControl.selectedSegmentIndex]; + [self.formViewController updateFormRow:self.inlineRowDescriptor]; +} + +#pragma mark - Helper + +-(NSArray *)getItems +{ + NSMutableArray * result = [[NSMutableArray alloc] init]; + for (id option in self.inlineRowDescriptor.selectorOptions) + [result addObject:[option displayText]]; + return result; +} + +-(void)updateSegmentedControl +{ + [self.segmentedControl removeAllSegments]; + + [[self getItems] enumerateObjectsUsingBlock:^(id object, NSUInteger idex, __unused BOOL *stop){ + [self.segmentedControl insertSegmentWithTitle:[object displayText] atIndex:idex animated:NO]; + }]; +} + +-(NSInteger)selectedIndex +{ + XLFormRowDescriptor * formRow = self.inlineRowDescriptor ?: self.rowDescriptor; + if (formRow.value){ + for (id option in formRow.selectorOptions){ + if ([[option valueData] isEqual:[formRow.value valueData]]){ + return [formRow.selectorOptions indexOfObject:option]; + } + } + } + return -1; +} + +@end diff --git a/Examples/Objective-C/XLForm.xcodeproj/project.pbxproj b/Examples/Objective-C/XLForm.xcodeproj/project.pbxproj index 81e2ca8a..1c4a757a 100644 --- a/Examples/Objective-C/XLForm.xcodeproj/project.pbxproj +++ b/Examples/Objective-C/XLForm.xcodeproj/project.pbxproj @@ -42,6 +42,7 @@ 3C3B01F01AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C3B01EF1AB74BDC0027CD45 /* FloatLabeledTextFieldCell.m */; }; 3CDAFC7A1AB0AFA4000F75B6 /* CustomRowsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CDAFC791AB0AFA4000F75B6 /* CustomRowsViewController.m */; }; 66B6266E1AE0055100007886 /* DateAndTimeValueTrasformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */; }; + BF01E9281C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */; }; BF9DB1D51AE0436600B985E7 /* BlogExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */; }; BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BF9DB1D41AE0436600B985E7 /* PredicateFormViewController.m */; }; BFA5F4B11BB48F8E00D045BD /* XLFormRatingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3C3B01D41AB741EF0027CD45 /* XLFormRatingCell.xib */; }; @@ -114,6 +115,8 @@ 66B6266D1AE0055100007886 /* DateAndTimeValueTrasformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DateAndTimeValueTrasformer.m; path = Examples/Dates/DateAndTimeValueTrasformer.m; sourceTree = ""; }; 7B0D2D6A86E2A41ED22E8A35 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 976A33EE62A018A7257B4878 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + BF01E9261C21F0BB00BDE045 /* XLFormInlineSegmentedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XLFormInlineSegmentedCell.h; path = "Inline Segmented/XLFormInlineSegmentedCell.h"; sourceTree = ""; }; + BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XLFormInlineSegmentedCell.m; path = "Inline Segmented/XLFormInlineSegmentedCell.m"; sourceTree = ""; }; BF9DB1D11AE0436600B985E7 /* BlogExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlogExampleViewController.h; path = Examples/PredicateExamples/BlogExampleViewController.h; sourceTree = SOURCE_ROOT; }; BF9DB1D21AE0436600B985E7 /* BlogExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BlogExampleViewController.m; path = Examples/PredicateExamples/BlogExampleViewController.m; sourceTree = SOURCE_ROOT; }; BF9DB1D31AE0436600B985E7 /* PredicateFormViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PredicateFormViewController.h; path = Examples/PredicateExamples/PredicateFormViewController.h; sourceTree = SOURCE_ROOT; }; @@ -416,6 +419,7 @@ 3CDAFC741AB0AEE5000F75B6 /* CustomRows */ = { isa = PBXGroup; children = ( + BF01E9251C21F02D00BDE045 /* Inline Segmented */, 3C3B01D01AB741C40027CD45 /* Rating */, 3C3B01E31AB74AC10027CD45 /* FloatLabeledTextField */, 3C3B01D11AB741CC0027CD45 /* Weekdays */, @@ -425,6 +429,15 @@ name = CustomRows; sourceTree = ""; }; + BF01E9251C21F02D00BDE045 /* Inline Segmented */ = { + isa = PBXGroup; + children = ( + BF01E9261C21F0BB00BDE045 /* XLFormInlineSegmentedCell.h */, + BF01E9271C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m */, + ); + name = "Inline Segmented"; + sourceTree = ""; + }; BFD5D6F41AD2FFC1006F04FA /* PredicateExamples */ = { isa = PBXGroup; children = ( @@ -590,6 +603,7 @@ 3C3B01E21AB7499A0027CD45 /* XLRatingView.m in Sources */, 283B59B219532415000828CD /* MapViewController.m in Sources */, 2843EB4718D4915800F13E2B /* ExamplesFormViewController.m in Sources */, + BF01E9281C21F0BB00BDE045 /* XLFormInlineSegmentedCell.m in Sources */, BF9DB1D61AE0436600B985E7 /* PredicateFormViewController.m in Sources */, BFE91AFB1AE159B200DE5231 /* BasicPredicateViewController.m in Sources */, 2843EB5218D4CFC700F13E2B /* OthersFormViewController.m in Sources */, diff --git a/Examples/Swift/Examples/CustomRows/CustomRowsViewController.swift b/Examples/Swift/Examples/CustomRows/CustomRowsViewController.swift index b8390f49..c0ff4300 100644 --- a/Examples/Swift/Examples/CustomRows/CustomRowsViewController.swift +++ b/Examples/Swift/Examples/CustomRows/CustomRowsViewController.swift @@ -30,6 +30,7 @@ class CustomRowsViewController : XLFormViewController { static let CustomRowFloatLabeledTextFieldTag = "CustomRowFloatLabeledTextFieldTag" static let CustomRowWeekdays = "CustomRowWeekdays" static let CustomRowText = "CustomText" + static let CustomRowInline = "CustomRowInline" } override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { @@ -92,6 +93,15 @@ class CustomRowsViewController : XLFormViewController { ] section.addFormRow(row) + section = XLFormSectionDescriptor.formSectionWithTitle("Custom inline row") + form.addFormSection(section) + + // Inline + row = XLFormRowDescriptor(tag: Tags.CustomRowInline, rowType: XLFormRowDescriptorTypeSegmentedInline) + row.title = "You support..." + row.selectorOptions = ["Uruguay", "Brazil", "Argentina", "Chile"] + row.value = "Uruguay" + section.addFormRow(row) section = XLFormSectionDescriptor() form.addFormSection(section) diff --git a/Examples/Swift/Examples/CustomRows/InlineSegmentedCell/InlineSegmentedCell.swift b/Examples/Swift/Examples/CustomRows/InlineSegmentedCell/InlineSegmentedCell.swift new file mode 100644 index 00000000..7add308b --- /dev/null +++ b/Examples/Swift/Examples/CustomRows/InlineSegmentedCell/InlineSegmentedCell.swift @@ -0,0 +1,144 @@ +// +// InlineSegmentedCell.swift +// SwiftExample +// +// Created by mathias Claassen on 16/12/15. +// Copyright © 2015 Xmartlabs. All rights reserved. +// + +import Foundation + +let XLFormRowDescriptorTypeSegmentedInline = "XLFormRowDescriptorTypeSegmentedInline" +let XLFormRowDescriptorTypeSegmentedControl = "XLFormRowDescriptorTypeSegmentedControl" + + +class InlineSegmentedCell : XLFormBaseCell { + + override func canBecomeFirstResponder() -> Bool { + return true + } + + override func becomeFirstResponder() -> Bool { + if isFirstResponder() { + return super.becomeFirstResponder() + } + let result = super.becomeFirstResponder() + if result { + let inlineRowDescriptor : XLFormRowDescriptor = XLFormRowDescriptor(tag: nil, rowType: XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes()![rowDescriptor!.rowType] as! String) + let cell = inlineRowDescriptor.cellForFormController(formViewController()) + let inlineCell = cell as? XLFormInlineRowDescriptorCell + inlineCell?.inlineRowDescriptor = rowDescriptor + rowDescriptor?.sectionDescriptor.addFormRow(inlineRowDescriptor, afterRow: rowDescriptor!) + formViewController().ensureRowIsVisible(inlineRowDescriptor) + } + return result + } + + override func resignFirstResponder() -> Bool { + if isFirstResponder() { + return super.resignFirstResponder() + } + let selectedRowPath : NSIndexPath = formViewController().form.indexPathOfFormRow(rowDescriptor!)! + let nextRowPath = NSIndexPath(forRow: selectedRowPath.row + 1, inSection: selectedRowPath.section) + let nextFormRow = formViewController().form.formRowAtIndex(nextRowPath) + let section : XLFormSectionDescriptor = formViewController().form.formSectionAtIndex(UInt(nextRowPath.section))! + let result = super.resignFirstResponder() + if result { + section.removeFormRow(nextFormRow!) + } + return result + } + + //Mark: - XLFormDescriptorCell + + override func formDescriptorCellCanBecomeFirstResponder() -> Bool { + return rowDescriptor?.isDisabled() == false + } + + override func formDescriptorCellBecomeFirstResponder() -> Bool { + if isFirstResponder() { + resignFirstResponder() + return false + } + return becomeFirstResponder() + } + + override func update() { + super.update() + accessoryType = .None + editingAccessoryType = .None + selectionStyle = .None + textLabel?.text = rowDescriptor?.title + detailTextLabel?.text = valueDisplayText() + } + + override func formDescriptorCellDidSelectedWithFormController(controller: XLFormViewController!) { + controller.tableView.deselectRowAtIndexPath(controller.form.indexPathOfFormRow(rowDescriptor!)!, animated: true) + } + + func valueDisplayText() -> String? { + if let value = rowDescriptor?.value { + return value.displayText() + } + return rowDescriptor?.noValueDisplayText + } +} + +class InlineSegmentedControl : XLFormBaseCell, XLFormInlineRowDescriptorCell { + + var inlineRowDescriptor : XLFormRowDescriptor? + lazy var segmentedControl : UISegmentedControl = { + return UISegmentedControl.autolayoutView() as! UISegmentedControl + }() + + override func configure() { + super.configure() + selectionStyle = .None + contentView.addSubview(segmentedControl) + contentView.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[segmentedControl]-|", options: .AlignAllCenterY, metrics: nil, views: ["segmentedControl": segmentedControl])) + segmentedControl.addTarget(self, action: "valueChanged", forControlEvents: .ValueChanged) + } + + override func update() { + super.update() + updateSegmentedControl() + segmentedControl.selectedSegmentIndex = selectedIndex() + segmentedControl.enabled = rowDescriptor?.isDisabled() == false + } + + //MARK: Actions + + func valueChanged() { + inlineRowDescriptor!.value = inlineRowDescriptor!.selectorOptions![segmentedControl.selectedSegmentIndex] + formViewController().updateFormRow(inlineRowDescriptor) + } + + //MARK: Helpers + + func getItems() -> NSMutableArray { + let result = NSMutableArray() + for option in inlineRowDescriptor!.selectorOptions! { + result.addObject(option.displayText()) + } + return result + } + + func updateSegmentedControl() { + segmentedControl.removeAllSegments() + getItems().enumerateObjectsUsingBlock { [weak self] object, index, stop in + self?.segmentedControl.insertSegmentWithTitle(object.displayText(), atIndex: index, animated: false) + } + } + + func selectedIndex() -> Int { + let formRow = inlineRowDescriptor ?? rowDescriptor + if let value = formRow?.value { + for option in (formRow?.selectorOptions)! { + if option.valueData().isEqual(value.valueData()){ + return formRow?.selectorOptions?.indexOf({ $0.isEqual(option) }) ?? -1 + } + } + } + return -1 + } +} \ No newline at end of file diff --git a/Examples/Swift/SwiftExample.xcodeproj/project.pbxproj b/Examples/Swift/SwiftExample.xcodeproj/project.pbxproj index fd3fddb8..0d353690 100644 --- a/Examples/Swift/SwiftExample.xcodeproj/project.pbxproj +++ b/Examples/Swift/SwiftExample.xcodeproj/project.pbxproj @@ -38,6 +38,7 @@ 28D8326C1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326B1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift */; }; 28D8326F1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D8326E1AEC2D1B009E3B3F /* UICustomizationFormViewController.swift */; }; 28F490221AAFBBC600C8E0CC /* DatesFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F490211AAFBBC600C8E0CC /* DatesFormViewController.swift */; }; + BF01E92B1C21FF2800BDE045 /* InlineSegmentedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */; }; DD7B43598E698717584375E9 /* libPods-SwiftExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */; }; /* End PBXBuildFile section */ @@ -79,6 +80,7 @@ 2EB9C638FC2450A0B9786D1E /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = ""; }; 420D9BAB7B0D2AF9487DD060 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = ""; }; 9CFB9BA3A82D5F6FE7CCE5A5 /* libPods-SwiftExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwiftExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InlineSegmentedCell.swift; path = InlineSegmentedCell/InlineSegmentedCell.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -146,6 +148,7 @@ 286067311AEDBD4A002F1E04 /* CustomRows */ = { isa = PBXGroup; children = ( + BF01E9291C21FEF700BDE045 /* Inline Segmented */, 286067321AEDBD4A002F1E04 /* CustomRowsViewController.swift */, 286067331AEDBD4A002F1E04 /* FloatLabeledTextField */, 286067351AEDBD4A002F1E04 /* Rating */, @@ -338,6 +341,14 @@ name = Pods; sourceTree = ""; }; + BF01E9291C21FEF700BDE045 /* Inline Segmented */ = { + isa = PBXGroup; + children = ( + BF01E92A1C21FF2800BDE045 /* InlineSegmentedCell.swift */, + ); + name = "Inline Segmented"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -449,6 +460,7 @@ files = ( 28B920781AE73AA600BD6382 /* SelectorsFormViewController.swift in Sources */, 28D832671AEBEAA0009E3B3F /* BlogExampleViewController.swift in Sources */, + BF01E92B1C21FF2800BDE045 /* InlineSegmentedCell.swift in Sources */, 28D8326C1AEC177E009E3B3F /* ValidationExamplesFormViewController.swift in Sources */, 286067411AEDBD4A002F1E04 /* XLFormRatingCell.swift in Sources */, 28F490221AAFBBC600C8E0CC /* DatesFormViewController.swift in Sources */, diff --git a/Examples/Swift/SwiftExample/AppDelegate.swift b/Examples/Swift/SwiftExample/AppDelegate.swift index f9b17453..b4998ee1 100644 --- a/Examples/Swift/SwiftExample/AppDelegate.swift +++ b/Examples/Swift/SwiftExample/AppDelegate.swift @@ -20,6 +20,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeRate] = "XLFormRatingCell" XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeFloatLabeledTextField] = FloatLabeledTextFieldCell.self XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeWeekDays] = "XLFormWeekDaysCell" + XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = InlineSegmentedCell.self + XLFormViewController.cellClassesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedControl] = InlineSegmentedControl.self + XLFormViewController.inlineRowDescriptorTypesForRowDescriptorTypes()[XLFormRowDescriptorTypeSegmentedInline] = XLFormRowDescriptorTypeSegmentedControl // Override point for customization after application launch. self.window = UIWindow.init(frame: UIScreen.mainScreen().bounds)