• Stars
    star
    135
  • Rank 263,834 (Top 6 %)
  • Language
    Swift
  • License
    Other
  • Created almost 10 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Interactive static table views with ease

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 5, so it requires that you use Xcode 10.2. It supports iOS 8.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

There is a sample project that demonstrates a number of ways to make use of TableSchemer. To run them, clone the repo and run the TableSchemerExamples target.

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) 2019, Square

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.

More Repositories

1

Cereal

Swift object serialization
Swift
369
star
2

OrderedSet

A Swift collection of unique, ordered objects
Swift
251
star
3

phpstan-laravel

Laravel plugins for PHPStan
PHP
51
star
4

JSONValue

Simple, awesome JSON representations in Swift
Swift
45
star
5

AnchorKit

A Swifty anchor-based API for AutoLayout.
Swift
45
star
6

Try

Handle Objective-C Exceptions with Swift's error handling system
Objective-C
20
star
7

laravel-mutate

Mutate Laravel attributes
PHP
13
star
8

Hare

Hare is a HTTP to RabbitMQ publishing gateway, written in Go
Go
12
star
9

weebly-client-php

A php client for using the Weebly Platform API
PHP
9
star
10

php-webhook-client

Webhook client which sets up basic oauth flow and webhook event subscription.
PHP
9
star
11

cloud-client-php

A php client for using the Weebly Cloud API
PHP
9
star
12

base-less-theme

This is the starting point for LESS based Weebly themes
JavaScript
8
star
13

base-css-theme

This is the starting point for css based Weebly themes
JavaScript
7
star
14

node-webhook-client

Webhook client which sets up basic oauth flow and webhook event subscription.
JavaScript
4
star
15

bootstrap-app

Smarty
4
star
16

node-weebly

CLI for Weebly Platform App Developers
JavaScript
4
star
17

cloud-client-python

A python client for using the Weebly Cloud API
Python
4
star
18

tinydns-filter

A filter to run before tinydns-data to handle extra resource record types
Perl
3
star
19

team-cards-app

Display an image and brief text in card format
JavaScript
3
star
20

ghost-io-php

Unofficial ghost.io API library for PHP
PHP
3
star
21

weeblybundler

WeeblyBundler is a CLI tool created to enable Weebly Platform Developers to rapidly deploy their apps and upload their themes
Ruby
3
star
22

simple-table-app

Add a table to your website
JavaScript
2
star
23

code-block-app

Display code at a glance
JavaScript
2
star
24

element-hello-world

A simple app to help Weebly Developers easily understand how Weebly Elements are constructed.
Smarty
2
star
25

swift-jsonpatch

Swift
1
star
26

cloud-client-java

A java client for using the Weebly Cloud API
Java
1
star
27

cloud-client-ruby

A ruby client for using the Weebly Cloud API
Ruby
1
star
28

accordion-app

Display only the most important information
JavaScript
1
star
29

TASTE

The Automated Selenium Testing Environment
Python
1
star