Latest 0.1.5
Homepage https://github.com/setoff/EasyForm
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

This is UITableViewDataSource/UITableViewDelegate form constructor solution. It allows to use UITableView/UITableViewCell customization abilities. We provide several basic Cells. If you haven’t found any particular form UI element you can easily create it by yourself with familiar tools like InterfaceBuilder (using cell xibs) or by subclassing UITableViewCell. And pull-requests are welcome!

Form configuration and logic can be implemented in declarative way. Can be placed in separate module and reused in different view controllers.

Try

You have two options to try lib:

$ git clone [email protected]:setoff/EasyForm.git
$ cd EasyForm/Example
$ pod install
$ open EasyForm.xcworkspace

or

$ pod try EasyForm

After workspace has been opened select EasyForm-Example target and run app.

Usage

EFForm implements UITableViewDelegate and UITableViewDataSource protocols. So you can easily use form with any instance of UITableView. But it is recommended to use with UITableViewController (or subclasses) because of several ‘free’ features like scrolling to focused text field which placed in UITableViewCell.

Form implementation structure looks like this:

self.form = [EFForm new];

// Config form items
EFElement *input = [[EFElement alloc] initWithTag:@"inputField"
                                        cellClass:[EFTextFieldCell class]];
input.setupCell = ^(UITableViewCell *cell) {
    ((EFTextFieldCell *)cell).textField.placeholder = @"Tap to start typing";
};

EFElement *switchElement = [[EFElement alloc] initWithTag:@"switch"
                                                cellClass:[EFSwitchCell class]];
switchElement.setupCell = ^(UITableViewCell *cell) {
    ((EFSwitchCell *)cell).titleLabel.text = @"Cell with switch";
    ((EFSwitchCell *)cell).switchToggle.onTintColor = [EFExampleHelpers greenColor];
    ((EFSwitchCell *)cell).onToggle = ^(BOOL isOn) {
        [self.presentingController alertAction:[NSString stringWithFormat:@"Toggle is %@",
                                                isOn ? @"ON" : @"OFF"]];
    };
};

// Config section and add form elements
EFSection *inputSection = [[EFSection alloc] initWithTag:@"predefined"
                                              elements:@[input, switchElement]];
inputSection.title = @"Form section";

// Add sections to form
self.form.sections = @[inputSection];
[self.tableView displayForm:self.form];

Installation

EasyForm is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "EasyForm"

License

EasyForm is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "EasyForm",
    "version": "0.1.5",
    "summary": "UITableView-based declarative form constructor.",
    "description": "`UITableView`-based wrapper for easily creating forms in declarative style.",
    "homepage": "https://github.com/setoff/EasyForm",
    "license": "MIT",
    "authors": {
        "Ilya Sedov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/setoff/EasyForm.git",
        "tag": "0.1.5"
    },
    "social_media_url": "https://twitter.com/cdog_ya",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "subspecs": [
        {
            "name": "Core",
            "source_files": "EasyForm/Core/**/*.{h,m,c}",
            "frameworks": "UIKit"
        },
        {
            "name": "Cells",
            "source_files": "EasyForm/Cells/**/*.{h,m,c}",
            "frameworks": "UIKit"
        },
        {
            "name": "Tools",
            "source_files": "EasyForm/Tools/**/*.{h,m,c}",
            "frameworks": "UIKit"
        }
    ]
}

Pin It on Pinterest

Share This