Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Former is a fully customizable Swift library for easy creating UITableView based form.

Subscribe to updates I use Former

Statistics on Former

Number of watchers on Github 992
Number of open issues 9
Average time to close an issue 11 days
Main language Swift
Average time to merge a PR about 1 month
Open pull requests 12+
Closed pull requests 2+
Last commit almost 2 years ago
Repo Created over 4 years ago
Repo Last Updated almost 2 years ago
Size 773 KB
Organization / Authorra1028
Page Updated
Do you use Former? Leave a review!
View open issues (9)
View Former activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating Former for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Former is a fully customizable Swift library for easy creating UITableView based form.

Swift3 CocoaPods Shield Carthage compatible MIT License




  • Xcode 8
  • Swift 3
  • iOS 8.0 or later

Still wanna use iOS7 and swift 2.2 or 2.3?
-> You can use 1.4.0 instead.



Add the following line to your Podfile:


target 'YOUR_TARGET_NAME' do

  pod 'Former'



Add the following line to your Cartfile:

github "ra1028/Former"


You can set the cell's appearance and events-callback at the same time.
ViewController and Cell do not need to override the provided defaults.

Simple Example

import Former

final class ViewController: FormViewController {

    override func viewDidLoad() {
        let labelRow = LabelRowFormer<FormLabelCell>()
            .configure { row in
                row.text = "Label Cell"
            }.onSelected { row in
                // Do Something
        let inlinePickerRow = InlinePickerRowFormer<FormInlinePickerCell, Int>() {
            $0.titleLabel.text = "Inline Picker Cell"
            }.configure { row in
                row.pickerItems = (1...5).map {
                    InlinePickerItem(title: "Option\($0)", value: Int($0))
            }.onValueChanged { item in
                // Do Something
        let header = LabelViewFormer<FormLabelHeaderView>() { view in
            view.titleLabel.text = "Label Header"
        let section = SectionFormer(rowFormer: labelRow, inlinePickerRow)
            .set(headerViewFormer: header)
        former.append(sectionFormer: section)


RowFormer is the base class of the class that manages the cell. A cell that is managed by the RowFormer class should conform to the corresponding protocol. Each of the RowFormer classes exposes event handling in functions named on* (e.g., onSelected, onValueChanged, etc...)
Default provided RowFormer classes and the protocols that corresponding to it are listed below.

Demo Class Protocol Default provided cell
Free CustomRowFormer None None
LabelRowFormer LabelFormableRow FormLabelCell
TextFieldRowFormer TextFieldFormableRow FormTextFieldCell
TextViewRowFormer TextViewFormableRow FormTextViewCell
CheckRowFormer CheckFormableRow FormCheckCell
SwitchRowFormer SwitchFormableRow FormSwitchCell
StepperRowFormer StepperFormableRow FormStepperCell
SegmentedRowFormer SegmentedFormableRow FormSegmentedCell
SliderRowFormer SliderFormableRow FormSliderCell
PickerRowFormer PickerFormableRow FormPickerCell
DatePickerRowFormer DatePickerFormableRow FormDatePickerCell
SelectorPickerRowFormer SelectorPickerFormableRow FormSelectorPickerCell
SelectorDatePickerRowFormer SelectorDatePickerFormableRow FormSelectorDatePickerCell
InlinePickerRowFormer InlinePickerFormableRow FormInlinePickerCell
InlineDatePickerRowFormer InlineDatePickerFormableRow FormInlineDatePickerCell

example with LabelRowFormer

let labelRow = LabelRowFormer<YourLabelCell>(instantiateType: .Nib(nibName: "YourLabelCell")) {
    $0.titleLabel.textColor = .blackColor()
    }.configure { row in
        row.rowHeight = 44
        row.text = "Label Cell"
    }.onSelected { row in
        print("\(row.text) Selected !!")

update the cell

row.update { row in
    row.text = "Updated title"
row.cellUpdate { cell in
    cell.titleLabel.textColor = .redColor()

get cell instance

let cell = row.cell

set dynamic row height

row.dynamicRowHeight { tableView, indexPath -> CGFloat in
    return 100


ViewFormer is base class of the class that manages the HeaderFooterView.
A HeaderFooterView that is managed by the ViewFormer class should conform to the corresponding protocol. Default provided ViewFormer classes and the protocols that correspond to it are listed below.

Demo Class Protocol Default provided cell
Free CustomViewFormer None None
LabelViewFormer LabelFormableView FormLabelHeaderView FormLabelFooterView

example with LabelViewFormer

let headerView = LabelViewFormer<YourLabelView>(instantiateType: .Nib(nibName: "YourLabelView")) {
    $0.titleLabel.textColor = .blackColor()
    }.configure { view in
        view.viewHeight = 30
        view.text = "Label HeaderFooter View"


SectionFormer is a class that represents the Section of TableView.
SectionFormer can append, add, insert, remove the RowFormer and set the ViewFormer.

let section = SectionFormer(rowFormer: row1, row2, row3)
    .set(headerViewFormer: headerView)
    .set(footerViewFormer: footerView)

add the cell

section.append(rowFormer: row1, row2, row3)
section.add(rowFormers: rows)
section.insert(rowFormer: row, toIndex: 3)
section.insert(rowFormer: row, below: otherRow)
// etc...

remove the cell

section.remove(rowFormer: row)
// etc...

set the HeaderFooterViewe

section.set(headerViewFormer: headerView)
section.set(footerViewFormer: footerView)


Former is a class that manages the entire form.
Examples is below.
add the section or cell

former.append(sectionFormer: row)
former.add(sectionFormers: rows)
former.insert(sectionFormer: section, toSection: 0)
former.insert(rowFormer: row, toIndexPath: indexPath)
former.insert(sectionFormer: section, above: otherSection)
former.insert(rowFormers: row, below: otherRow)
// etc...

// with animation
former.insertUpdate(sectionFormer: section, toSection: 0, rowAnimation: .Automatic)
former.insertUpdate(rowFormer: row, toIndexPath: indexPath, rowAnimation: .Left)
former.insertUpdate(sectionFormer: section, below: otherSection, rowAnimation: .Fade)
former.insertUpdate(rowFormers: rows, above: otherRow, rowAnimation: .Bottom)
// etc...

remove the section or cell

former.remove(rowFormer: row1, row2)
former.remove(sectionFormer: section1, section2)
// etc...

// with animation
former.removeUpdate(sectionFormers: sections, rowAnimation: .Middle)
// etc...

Select and deselect the cell indexPath, animated: true, scrollPosition: .Middle) row, animated: true)
// etc...

end editing


become editing next/previous cell

if former.canBecomeEditingNext() {
if former.canBecomeEditingPrevious() {

functions to setting event handling

public func onCellSelected(handler: (NSIndexPath -> Void)) -> Self
public func onScroll(handler: ((scrollView: UIScrollView) -> Void)) -> Self    
public func onBeginDragging(handler: (UIScrollView -> Void)) -> Self
public func willDeselectCell(handler: (NSIndexPath -> NSIndexPath?)) -> Self
public func willDisplayCell(handler: (NSIndexPath -> Void)) -> Self
public func willDisplayHeader(handler: (/*section:*/Int -> Void)) -> Self
public func willDisplayFooter(handler: (/*section:*/Int -> Void)) -> Self        
public func didDeselectCell(handler: (NSIndexPath -> Void)) -> Self
public func didEndDisplayingCell(handler: (NSIndexPath -> Void)) -> Self
public func didEndDisplayingHeader(handler: (/*section:*/Int -> Void)) -> Self
public func didEndDisplayingFooter(handler: (/*section:*/Int -> Void)) -> Self
public func didHighlightCell(handler: (NSIndexPath -> Void)) -> Self
public func didUnHighlightCell(handler: (NSIndexPath -> Void)) -> Self


There is no need to inherit from the FormViewController class.
Instead, create an instance of UITableView and Former, as in the following example.

final class YourViewController: UIViewController {    

    private let tableView: UITableView = UITableView(frame:, style: .Grouped) // It may be IBOutlet. Not forget to addSubview.
    private lazy var former: Former = Former(tableView: self.tableView)


Cell There is likewise no need to inherit from the default provided cell class (FormLabelCell etc ...); only conform to the corresponding protocol. You can use Nibs, of course. An example with LabelRowFormer:

final class YourCell: UITableViewCell, LabelFormableRow {

    // MARK: LabelFormableRow

    func formTextLabel() -> UILabel? {
        return titleLabel

    func formSubTextLabel() -> UILabel? {
        return subTitleLabel

    func updateWithRowFormer(rowFormer: RowFormer) {
        // Do something

    // MARK: UITableViewCell

    var titleLabel: UILabel?
    var subTitleLabel: UILabel?


RowFormer If you want to create a custom RowFormer, make your class inherit from BaseRowFormer and comply with the Formable protocol.
It must conform to ConfigurableInlineForm. In the case of InlineRowFomer, conform to the UpdatableSelectorForm case of SelectorRowFormer. Please look at the source code for details.
Examples of RowFormer using cells with two UITextFields:

public protocol DoubleTextFieldFormableRow: FormableRow {

    func formTextField1() -> UITextField
    func formTextField2() -> UITextField

public final class DoubleTextFieldRowFormer<T: UITableViewCell where T: DoubleTextFieldFormableRow>
: BaseRowFormer<T>, Formable {

    // MARK: Public

    override public var canBecomeEditing: Bool {
        return enabled

    public var text1: String?
    public var text2: String?

    public required init(instantiateType: Former.InstantiateType = .Class, cellSetup: (T -> Void)? = nil) {
        super.init(instantiateType: instantiateType, cellSetup: cellSetup)

    public final func onText1Changed(handler: (String -> Void)) -> Self {
        onText1Changed = handler
        return self

    public final func onText2Changed(handler: (String -> Void)) -> Self {
        onText2Changed = handler
        return self

    open override func cellInitialized(cell: T) {
        cell.formTextField1().addTarget(self, action: "text1Changed:", forControlEvents: .EditingChanged)
        cell.formTextField2().addTarget(self, action: "text2Changed:", forControlEvents: .EditingChanged)

    open override func update() {

        cell.selectionStyle = .None
        let textField1 = cell.formTextField1()
        let textField2 = cell.formTextField2()
        textField1.text = text1
        textField2.text = text2        

    // MARK: Private

    private final var onText1Changed: (String -> Void)?
    private final var onText2Changed: (String -> Void)?    

    private dynamic func text1Changed(textField: UITextField) {
        if enabled {
            let text = textField.text ?? ""
            self.text1 = text

    private dynamic func text2Changed(textField: UITextField) {
        if enabled {
            let text = textField.text ?? ""
            self.text2 = text


If you're interesting in helping us improve and maintain Former, it is highly encouraged that you fork the repository and submit a pull request with your updates.

If you do chose to submit a pull request, please make sure to clearly document what changes you have made in the description of the PR.

Submitting Issues

If you find yourself having any issues with Former, feel free to submit an issue. Please BE SURE to include the following:


If your issue doesn't contain this information, it will be closed due to lack of information.


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

Former open issues Ask a question     (View All Issues)
  • over 3 years CustomRowFormer for Button
  • over 3 years FormCell init(style: UITableViewCellStyle, reuseIdentifier: String?) not public
  • over 3 years Serious performance issue, if open FormViewController for the first time.
  • over 3 years Docs inconsistent with implementation "SelecterPickerFormableRow"
  • over 3 years How can I add a title on the left side like the one in your example to a ui switch
  • over 3 years removeUpdate crashes on inline rows
  • over 3 years Double Text Field Cell Setup
  • over 3 years inline pickers: setting of selected item not reflected in the picker (iOS 9.3)
  • over 3 years `deinit` is newer called
  • over 3 years compilation error on tags 1.3.0
  • almost 4 years imageView in cells
  • almost 4 years Header color [feature request]
  • almost 4 years prototype cells
  • almost 4 years New Developer
  • almost 4 years Errore while hide/show dateRow
  • almost 4 years userinteraction enable or disable of cells
  • almost 4 years Can change style of UItableview
  • almost 4 years Enable editActionsForRowAtIndexPath
  • about 4 years not adapt for iPad
  • about 4 years Search not working
  • about 4 years Issues refreshing pickerItems
Former open pull requests (View All Pulls)
  • SelectorDatePickerRowFormer - make default date an optional instead of NSDate()
  • Update InlinePickerRowFormer.swift - system version check
  • Update TextViewRowFormer.swift
  • Make public isEditing variable
  • Add onCellWillSelect event & selectedIndexPath public get
  • fixed carthage 3.0 build error
  • Fix tableview editing crash when removing inline row formers
  • on editing begin/end closures for inlines row former
  • Numerous small grammatical tweaks
  • Typo, selecter -> selector.
  • ViewFormer update method with handler
Former questions on Stackoverflow (View All Questions)
  • Creating scopes on Audit with audited-activerecord gem for ruby on rails (former act_as_audited)
  • ARM: retrive former "lr" register from a data abort exception handler
  • Does reloading a WebView cancel former calls to setInterval()?
  • Replacing activity with fragment just overlays latter on top of former
  • Can I submit a new app version in iTunes Connect without cancelling the former that is "Pending developer release"?
  • Data from parent node (tried former)
  • angular $http how to prevent former response override later response?
  • How do I $watch the Angular-ui's new ui-select (former ui-select2) search string changes?
  • Web-interface for an API-only app requiring latter's user's details to be displayed in former without persisting it in its DB
  • [Symfony][FOSUserBundle] Can I get a user's former password
  • How do I trace former ids using a recursive query?
  • Debugging python (jython) code in Anypoint Studio (former Mule Studio)
  • WP Site Links Reverting to Former Subdomain
  • How to handle former global event handlers in ASP.NET 5?
  • 301 Redirect from former .htaccess stuck
  • Dependency Management in Android Studio of former multiproject Eclipse workspace with gradle and artifactory
  • Why can't I see a variable defined in b.js within a.js, despite including the former?
  • In Azure WebApps (former WebSites), can I get number of instances running?
  • What difference between and subprocess.Popen() makes PIPE less secure for the former?
  • How does Camlp5 (former Camlp4) parse expressions
  • Using former JCEKS with Python
  • htaccess redirect .htm to .html if former not exists and latter does
  • Implement with RxJs an observable whose values (x_n) are derived from its former value (x_n-1) and (-also triggered by-) another observable value?
  • Close tab with Google Web App to go back to former Url
  • Cannot merge branch with commits by former employee - Stash/GIT
  • Why is instantiating python class repeating former actions by other instances before doing new action?
  • How to ask git about former merge conflicts (even before the final commit)?
  • UIView transitionWithView with UIViewAnimationOptionRepeat: Is former view removed or not?
  • GREP for a dynamic pattern in a file and print the other lines having former pattern and another pattern
  • Git - branching strategy for former releases?
Former list of languages used
Other projects in Swift