The fastest and easiest way to present a UITableView - in 3 lines of code.

Overview

Swift Table

The fastest and easiest way to present a UITableView - in 3 lines of code.

Powered by Generics to present any data type.

No need to use the UITableViewDelegate and UITableViewDataSource protocols.

Swift Table is a free and open-source library that removes the hundreds of lines of code you need to create a fully-customized TableView.

Image examples of three TableViews

Example:

var table = Table(data: ["Adam", "Juan", "Kate", "Siddharth", "Mary", "Zhao"])
let tableView = table.show()
view.addSubview(tableView)

That is all you need!

Another example:

let table = Table(reuseIdentifier: “id”,
                  data: [“Krishna”, “Thomas”, “Jaimie”, “Susan”],
                  frame: view.frame)
                  {indexPath, element, cell in
                       print(“Tapped on element: \(element)”)
                        cell.addCheckmark()
              }

let tableView = table.show()

// Customization
table.setHeader(title: “Family!”)
table.setAccessory(style: .disclosureIndicator)

Features:

  • Supports single and multiple sections of data
  • Can show a subtitle and image label for each cell
  • Provide your own action triggered when a cell is tapped
  • Over 30 public methods to customize most aspects of TableViews - headers, cellHeight, accessories, fonts, colors and much more
  • Includes support for Documentation Compiler (DocC) to show code documentation and tips as you type
  • Supports Swift Package Manager (SPM) and Cocoapods dependency managers.

Benefits:

  • Reduce the hundreds of lines of codes you use for TableViews
  • Save dozens of hours of development time
  • Prevent confusing errors

Quick tips:

  • If you want to show a TableView with one section, insert one array into the data parameter or call the .setData() method. If you want to show a TableView with multiple sections, insert a multidimensional array into the datasets parameter or call the .setDatasets() method.
  • To perform any changes, try using the public methods on the Table class. For example: table.setCellHeight(54.0) or table.setTitleColor(color: .blue)
  • If your desired change is not in our public methods, try using table.addStyle() - which allows you to customize the TableView and its cells, indexPath and elements directly
  • To present your own custom class or struct, conform to the TableData protocol.
  • Open the Example folder to see an Xcode Project showing how to use Swift Table.
  • Current issue: if a TableView is not shown, make sure the Table variable is a global variable (outside of viewDidLoad or any other function) - for reference, see the Example project.

Installation:

Public methods:

Data:

  • append(element: D)
  • insert(element: D, at index: Int)
  • insert(element: D, at index: Int, datasetIndex: Int)
  • removeElement(at index: Int)
  • removeElement(at index: Int, datasetIndex: Int)
  • randomElement() -> D?
  • setData(data: [D])
  • setDatasets(datasets: [[D]])
  • shuffleElements()
  • removeAllElements()

Appearance:

  • setTitleFont(font: UIFont)
  • setTitleColor(color: UIColor)
  • setSubtitleFont(font: UIFont)
  • setSubtitleColor(color: UIColor)
  • setImageTint(color: UIColor)
  • setImageFrame(frame: CGRect)
  • setImageContentMode(contentMode: UIView.ContentMode)
  • setHeader(title: String)
  • setHeader(titles: [String])
  • setHeaderView(view: UIView)
  • setFooterView(view: UIView)
  • setAccessory(style: UITableViewCell.AccessoryType)
  • setAccessoryColor(color: UIColor)
  • setCellHeight(height: Float)
  • setSeparatorColor(color: UIColor)
  • setSeparatorInset(edgeInsets: UIEdgeInsets)
  • setKeyboardDismiss(mode: UIScrollView.KeyboardDismissMode)
  • setAction(action: @escaping (IndexPath, D, UITableViewCell)
  • setAccessoryAction(action: @escaping (IndexPath, D, UITableViewCell) -> Void)
  • addStyle(style: @escaping (UITableView, IndexPath, D, UITableViewCell) -> Void)
  • clearStyles()

Access TableView:

  • show() -> UITableView
  • hide()
  • setFrame(frame: CGRect)
  • showFrame() -> CGRect

Created by:

Benyam Alemu Sood and Jigyasaa Alemu Sood, 2022.

Swift Table is a free and opensource library distributed under the MIT License. You may use the source code for free in any of our personal and commercial libraries.

If you would like to, you may create any articles, tutorials or videos describing any component of this library.

Swift Table will always be free to use and openly available.

If this project helps you, consider donating! Sponsor us here to support new innovations for iOS Developers

Collaboration:

We are in active development. We welcome collaboration.

Feel free to send any pull requests or proposed changes to our codebase. Submit your ideas and code improvements.

You might also like...
API-TableView-Swift - API call with URLSession and show data to TableView with swift
API-TableView-Swift - API call with URLSession and show data to TableView with swift

API-TableView-Swift API call with URLSession and show data to TableView with swi

✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package.

Refreshable ✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package. See complementary article at SwiftUI Pull to Refresh (for iOS 13 and iOS 14).

Easy background refresh registration, scheduling, execution, and completion. BGTaskScheduler for the lazy.

EasyBackgroundRefresh Easy background refresh registration, scheduling, execution, and completion. BGTaskScheduler for the lazy. Usage For fast refres

Simply the fastest way to transmit data between iOS/tvOS and OSX

DarkLightning DarkLightning is a lightweight Swift library to allow data transmission between iOS/tvOS devices (Lightning port, Dock connector, USB-C)

The fastest 🚀 way to embed a 3D model in Swift
The fastest 🚀 way to embed a 3D model in Swift

Insert3D is the easiest 🥳 and fastest 🚀 way to embed a 3D model in your iOS app. It combines SceneKit and Model I/O into a simple library for creati

A Generic CoreData Manager to accept any type of objects. Fastest way for adding a Database to your project.
A Generic CoreData Manager to accept any type of objects. Fastest way for adding a Database to your project.

QuickDB FileManager + CoreData ❗️ Save and Retrieve any thing in JUST ONE line of code ❗️ Fast usage dataBase to avoid struggling with dataBase comple

⏲ A tiny package to measure code execution time. Only 20 lines of code.

Measure ⏲ A tiny package to measure code execution time. Measure.start("create-user") let user = User() Measure.finish("create-user") Console // ⏲ Mea

HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.
HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.

HoverConversion ManiacDev.com referred. https://maniacdev.com/2016/09/hoverconversion-a-swift-ui-component-for-navigating-between-multiple-table-views

The fastest zero-tap iOS menu.
The fastest zero-tap iOS menu.

⚡️ Quicklook The fastest zero-tap iOS menu CariocaMenu is a simple, elegant, fast navigation menu for your iOS apps. 🏆 Features Accessible from a sin

MathEagle is named after the golden eagle, since this is the fastest bird in the world

Swift-MathEagle MathEagle is named after the golden eagle, since this is the fastest bird in the world (in horizontal flight). This project is meant t

The fastest iOS app to add a note to your email inbox
The fastest iOS app to add a note to your email inbox

Major Key How often are you on the run, or hanging out with friends, only to suddenly think of this really important thing you need to do when you're

The easiest way to show off your iOS taps and gestures for demos and videos.

It's ShowTime 🎥 Installation Swift Package Manager Cocoapods Manual Usage How it works Useful info Author License ShowTime is the simplest and best w

Fastlane - 🚀 The easiest way to automate building and releasing your iOS and Android apps
Fastlane - 🚀 The easiest way to automate building and releasing your iOS and Android apps

fastlane is a tool for iOS and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and relea

TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes
TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

JustPersist is the easiest and safest way to do persistence on iOS with Core Data support out of the box.
JustPersist is the easiest and safest way to do persistence on iOS with Core Data support out of the box.

JustPersist JustPersist is the easiest and safest way to do persistence on iOS with Core Data support out of the box. It also allows you to migrate to

Easiest way to create an attributed UITextView (with support for multiple links and from html)
Easiest way to create an attributed UITextView (with support for multiple links and from html)

AttributedTextView Easiest way to create an attributed UITextView (with support for multiple links and html). See the demo app and the playground for

XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.
XCMetrics is the easiest way to collect Xcode build metrics and improve developer productivity.

XCMetrics is the easiest way to collect Xcode builds metrics and improve your developer productivity. Overview 📈 Keep your build times under control

The easiest way to install and switch between multiple versions of Xcode - with a mouse click.
The easiest way to install and switch between multiple versions of Xcode - with a mouse click.

Xcodes.app The easiest way to install and switch between multiple versions of Xcode. If you're looking for a command-line version of Xcodes.app, try x

The easiest way to prepare, play, and remove sounds in your Swift app!

Chirp The easiest way to prepare, play, and remove sounds in your Swift app! ##Installation ###CocoaPods Installation Chirp is available on CocoaPods.

Comments
  • Added documentation target for SPI documentation.

    Added documentation target for SPI documentation.

    In your email, you mentioned that the package had DocC documentation. Adding this file, if you choose to, will cause the Swift Package Index to generate and host that DocC documentation on the web for you.

    If you would prefer not to, please feel free to close this PR!

    opened by daveverwer 2
  • Allow Table to be shown as a global variable

    Allow Table to be shown as a global variable

    Why:

    • Currently, Table can only produce a TableView (using its show method) and add it to the View Hierarchy if it is a global variable. The table can be shown when it is a variable inside of a View Controller but not when Table is a variable inside any other method ie. present in the scope of viewDidLoad() or anywhere else.
    • Current workaround: make sure Table is a global variable and reassign it later OR use setData() or any of the public methods to change its behavior.

    Acceptance criteria:

    • Allow the TableView to be shown if the Table variable is created in viewDidLoad.
    • Also test if you can create a Table from any non-lifecycle method you create.
    • Explain why Table had to be a global variable to display it's TableView onto the screen.

    Other:

    • Guess: Issue with the Table being removed from memory via ARC?
    • Not sure if it is a reference issue.
    help wanted 
    opened by sivx76 0
  • Exclude unnecessary files from SPM

    Exclude unnecessary files from SPM

    Why:

    • When pulling this repo using Swift Package Manager, Xcode will grab ALL the files into the repository including unnecessary ones.
    • We don't want to increase the file size of other projects and add unnecessary clutter.

    Acceptance criteria:

    • Modify Package.swift and the exclude parameter to remove all unnecessary files
    • Remove: ["Contributors Guide.rtf", "LICENSE", "Opportunties.rtf", "Tables.podspec", "Example", "Other", ".git", ".gitignore"]

    Other:

    • I tried using the exclude parameter but when pulling from SPM, I still see these files in Xcode.
    help wanted 
    opened by sivx76 0
  • Introduce GitHub actions

    Introduce GitHub actions

    Why:

    • We want to setup an automated process to make sure our Example project successfully compiles after every change to this library. We want to make sure there are no breaking changes in each pull request and push.

    Acceptance criteria:

    • Introduce GitHub actions into this repository to check the main branch and staging branch.
    • Trigger upon each pull request and push.
    • Check if the Swift code in the Xcode Project successfully builds and if the unit tests pass.
    • For now: we don't have unit tests. I added a placeholder testing suite.

    Other details:

    • I tried this before to no success. You can probably see a stream of past commits.
    enhancement help wanted 
    opened by sivx76 0
Releases(v1.0.1)
  • v1.0.1(Aug 17, 2022)

  • v1.0(Aug 15, 2022)

    The first public release of Swift Table.

    Includes:

    • Table class
    • TableData protocol
    • Public methods for Table
    • Utility extensions

    Let us know what you think. We hope you enjoy!

    Source code(tar.gz)
    Source code(zip)
Owner
Benyam Alemu Sood
Senior Software Engineer
Benyam Alemu Sood
DGDynamicHeightTableView - UITableView that supports auto calculated height by contents size

DGDynamicHeightTableView UITableView that supports auto calculated height by con

donggyu 6 Jul 22, 2022
An easy way to use pull-to-refresh.

MJRefresh An easy way to use pull-to-refresh ?? ✍??Release Notes: more details Contents New Features Dynamic i18n Switching SPM Supported Swift Chaini

M了个J 13.7k Jan 6, 2023
An easy way to use pull-to-refresh

CRRefresh an easy way to use pull-to-refresh, If you want to customize its UI style, you just need conform the specified protocol. We will not regular

CRAnimation 957 Dec 13, 2022
Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.

SVPullToRefresh + SVInfiniteScrolling These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities

Sam Vermette 4.9k Dec 1, 2022
Add PullToRefresh using animated GIF to any scrollView with just simple code

UzysAnimatedGifPullToRefresh Add PullToRefresh using animated GIF to any scrollView with just simple code UzysAnimatedGifPullToRefresh features: simpl

Jaehoon Jung 1.4k Nov 20, 2022
Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development.

KafkaRefresh Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development. Report bug · Request feature · 中文文档

H. H. Hsiang 1.2k Dec 11, 2022
Easily add vertical and horizontal pull to refresh to any UIScrollView. Can also add multiple pull-to-refesh views at once.

This is a fork from the famous SVPullToRefresh pod with 2 additional functionalities: Can add multiple pull-to-refresh views into one single UIScrollV

Hoang Tran 42 Dec 28, 2022
Simple refresh control for iOS based on SpriteKit and Core Graphics

RainyRefreshControl Simple refresh control for iOS based on SpriteKit and Core Graphics. Project inspired by concept of Yup Nguyen Installation Instal

Onix-Systems 680 Dec 29, 2022
ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

Vincent Li 1.7k Jan 8, 2023
Replacement of UIRefreshControl, and more functions.

ScrollEdgeControl Replacement of UIRefreshControl, and more functions. Overview ScrollEdgeControl is a UI component that is similar to UIRefreshContro

エウレカ 45 Dec 17, 2022