04

Over the years Xcode’s interface builder has vastly improved for the creation of UITableView’s, but if you need to create a table view programmatically that can be a tedious task.

Here’s a nice Swift based library from Weebly that allows you to create interactive table views with static content programmatically with a number of different schemes included called TableSchemer.

The included schemes allow you to easily set up a single cell, a group of cells from an array, an accordion view, a view with radio buttons, and you can create your own custom schemes. You can add interface elements such as buttons, switches, and text input views as desired.

This code example from the Wiki shows am example of creating a basic table cell:

let tableScheme = TableScheme() { (builder) in
    builder.buildSchemeSet { (builder) in
        builder.name = "Section Header"

        builder.buildScheme { (scheme: BasicScheme) in
            scheme.reuseIdentifier = "CellIdentifier"

            scheme.configurationHandler = { (cell) in
                cell.textLabel.text = "My Cell"
            }
        }
    }
}

You can find TableSchemer on Github here.