Form came out from our need to a form that could share logic between our iOS apps and our web clients, we found that JSON was one way to achieve this.
Form includes the following features:
- Multiple groups: For example you can have a group for personal details and another one for shipping information
- Field validations: We support
required,maximum length,minimum lengthandformat(regex). We also support many field types, for example:text,number,phone_number,email,date,nameand more - Custom sizes: Total
widthis handled as 100% whileheightis handled in chunks of 85 px - Custom fields: You can register your custom fields, it's pretty simple (our basic example includes how to make an
imagefield) - Formulas or computed values: We support fields that contain generated values from other fields
- Targets:
Hide,show,update,enable,disableorcleara field using a target. It's pretty powerful, you can even set a condition for your target to run - Dropdowns: Generating dropdowns is as easy as adding values to your field, values support
defaultflags, targets (in case you want to trigger hiding a field based on a selection), string values or numeric values and subtitles (in case you want to hint the consecuences of your selection)
Don't forget to check our Basic Demo for a basic example on how to use Form.
At the moment Form only supports the iPad, support for the iPhone will come soon.
This is the required form to create a basic form with a first name field.
[
{
"id":"group-id",
"title":"Group title",
"sections":[
{
"id":"section-0",
"fields":[
{
"id":"first_name",
"title":"First name",
"type":"name",
"size":{
"width":30,
"height":1
}
}
]
}
]
}
]- (FORMDataSource *)dataSource
{
if (_dataSource) return _dataSource;
_dataSource = [[FORMDataSource alloc] initWithJSON:self.JSON
collectionView:self.collectionView
layout:self.layout
values:nil
disabled:NO];
return _dataSource;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.collectionView.dataSource = self.dataSource;
}
Please check our playbook for guidelines on contributing.
Hyper made this. We're a digital communications agency with a passion for good code, and if you're using this library we probably want to hire you.
Forms is available under the MIT license. See the LICENSE file for more info.