Latest 3.1.0
Homepage https://github.com/Weebly/TableSchemer
License MIT
Platforms ios 8.0, requires ARC
Authors

TableSchemer is a framework for building static interactive table views. Interface Builder provides a great way to build out static table views, but not everyone uses interface builder, and adding interactivity to these table views is difficult. Writing interactive static table views traditionally is a tiresome task due to working with index paths, and having multiple delegate methods to handle configuration, sizing, and selection handling. They’re also a huge pain to maintain when the need to reorder them comes as you need to update the index paths in all those locations.

Carthage compatible

Features

Closure-based Table Views

Build your table view using closures, and have all of your cell(s) logic in one place. Forget index path comparisons, and focus on writing your logic. Thanks to Generics in Swift you can just work with your cell type and not worry about casting.

Built-in Schemes

TableSchemer comes with a variety of powerful schemes already built-in. Included is a basic scheme (for when you just need to render one cell), a radio scheme (for when you need a single cell in a group of cells selected at once), an array scheme (for when you need a dynamic set of cells backed by specific objects), and an accordion scheme (for when you need one cell to expand into many for a collapsed selection). Check out how to use them here.

Extendable

You can easily create your own Schemes and add them into your tables. With a few method overrides you can start creating unique, intuitive controls for your users.

Getting Started

  • Download TableSchemer and see it in action using the example app. See Sample Project for instructions on how to get the sample project running.
  • Start building your own tables by installing it in your own app. See Using Table Schemer for more information on how to use Table Schemer.

Requirements

TableSchemer is built using Swift 3, so it requires that you use Xcode 8. It supports iOS 7.0+.

Usage

TableSchemer works by creating a TableScheme object and setting it as your UITableView’s dataSource property. Here’s an example of using it with a UITableViewController:

class MasterViewController: UITableViewController {

    var tableScheme: TableScheme!

    override func viewDidLoad() {
        super.viewDidLoad()

        createTableScheme()
        tableView.rowHeight = 44.0
    }

    func createTableScheme() {
        tableScheme = TableScheme(tableView: tableView) { builder in
            builder.buildSchemeSet { builder in
                builder.buildScheme { (scheme: BasicSchemeBuilder<UITableViewCell>) in

                    scheme.configurationHandler = { cell in
                        cell.textLabel?.text = "Tap here for an advanced example."
                        cell.accessoryType = .disclosureIndicator
                    }

                    // We're specifying weak self here because handlers are retained by the schemes. Without it, we'd have a retain cycle.
                    scheme.selectionHandler = { [weak self] cell, scheme in
                        let advancedController = AdvancedTableSchemeViewController(style: .grouped)
                        self?.navigationController?.pushViewController(advancedController, animated: true)
                    }

                }
            }
        }
    }
}

TableSchemer will set itself as the data source and delegate of the table view. If you need to be the delegate to the table view update it after creating the scheme. To use the built-in selection and height handling you need to be sure to forward those delegate methods to the tableScheme object. The signatures are the same as in UITableViewDelegate. Check out the Using Table Schemer page for more, and be sure to check out our sample app!

Sample Project

The sample project makes use of CocoaPods. Be sure you have the latest installed. After downloading the project, run pod install from the root directory. After the command completes be sure to open the workspace file, and not the project file.

Contact

We’re also frequently in the Gitter chatroom!

Contributing

We love to have your help to make TableSchemer better. Feel free to

  • open an issue if you run into any problem.
  • fork the project and submit pull request. Before the pull requests can be accepted, a Contributors Licensing Agreement must be signed.

License

Copyright (c) 2014, Weebly

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Weebly nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Weebly, Inc BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Latest podspec

{
    "name": "TableSchemer",
    "version": "3.1.0",
    "summary": "Interactive static table views with ease",
    "description": "TableSchemer is a framework for building static interactive table views. Interface Builder provides a great way to build out static table views, but not everyone uses interface builder, and adding interactivity to these table views is difficult. Writing interactive static table views traditionally is a tiresome task due to working with index paths, and having multiple delegate methods to handle configuration, sizing, and selection handling. They're also a huge pain to maintain when the need to reorder them comes as you need to update the index paths in all those locations.",
    "homepage": "https://github.com/Weebly/TableSchemer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "James Richard": "[email protected]"
    },
    "social_media_url": "http://twitter.com/ketzusaka",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Weebly/TableSchemer.git",
        "tag": "v3.1.0"
    },
    "source_files": "TableSchemer/*.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This