xmartlabs /XLForm
XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C.
★ 5,718⑂ 927👁 150⑃ 308● 775▤ 16
+0
Daily
5,718
stars
927
forks
150
watchers
308
prs
775
issues
16
releases
README
!XLForm
If you are working in Swift then you should have a look at [Eureka], a complete re-design of XLForm in Swift and with more features.
We are not implementing any new features for XLForm anymore. However, if a critical issue arises we will fix it.
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 (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
!Screenshot of native Calendar Event Example
What XLForm does
----------------
Loads a form based on a declarative form definition.
Keeps track of definition changes on runtime to update the form interface accordingly. Further information on Dynamic Forms section of this readme.
Supports multivalued sections allowing us to create, delete or reorder rows. For further details see Multivalued Sections section bellow.
Supports custom rows definition.
Supports custom selectors. For further details of how to define your own selectors check 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.
Form data validation based on form definition.
Ability to easily navigate among rows, fully customizable.
Ability to show inputAccessoryView if needed. By default a navigation input accessory view is shown.
Read only mode for a particular row or the entire form.
Rows can be hidden or shown depending on other rows values. This can be done declaratively using NSPredicates. (see Make a row or section invisible depending on other rows values)
How to create a form
Create an instance of XLFormViewController
Swift
swift
class CalendarEventFormViewController : XLFormViewController {
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.initializeForm()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
self.initializeForm()
}
func initializeForm() {
// Implementation details covered in the next section.
}
}
Objective-C
objc
import "XLFormViewController.h"
@interface CalendarEventFormViewController: XLFormViewController
@end
objc
@interface ExamplesFormViewController ()
@end
@implementation ExamplesFormViewController
- (instancetype)initWithNibName:(NSString )nibNameOrNil bundle:(NSBundle )nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self){
[self initializeForm];
}
return self;
}
- (id)initWithCoder:(NSCoder )aDecoder {
self = [super initWithCoder:aDecoder];
if (self){
[self initializeForm];
}
returnTop issues
#252XLFormInlineSelectorCell overrides custom font11 comments · 2015-03-09#359Update Documentation / README / Examples for Swift10 comments · 2015-05-21#721Proposed improvement to XLFormDescriptorCell protocol for row heights & self-sizing9 comments · 2016-02-05#653iOS 9 UIPopoverController deprecation warning8 comments · 2015-11-25#1082How to change the section header or change tableview style6 comments · 2021-07-13#592Specify height or number of lines for text view?5 comments · 2015-09-29#548formValues() should (optionally) also include hidden rows5 comments · 2015-09-10#463Multi-select value picker using the Swift Language?5 comments · 2015-07-27
Latest release
4.3.0 4.3.0 2021-03-24Add datePicker style property to XLFormDateCell (1078)