Swiftpack.co - 0x0c/TableViewContent as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Declare tableView row and section header/footer easy way.
.package(url: "https://github.com/0x0c/TableViewContent.git", from: "5.0.0")


Version License Platform


To run the example project, clone the repo, and run pod install from the Example directory first.



TableViewContent is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TableViewContent'


You can declare table view sections and cells as follows:

Section {
    DefaultRow(title: "title")
    DefaultRow(title: "title", style: .subtitle)
    DefaultRow(title: "title", style: .value1)
    DefaultRow(title: "title", style: .value2)

To handle cell selection, call didSelect method.

DefaultRow(title: "title", style: .value2)
.didSelect { _, _, _ in
    let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ViewController")
    self.navigationController?.pushViewController(viewController, animated: true)

Define class that inherit Row<T: UITableViewCell> for implementing custom row.

class CustomTableViewCell: UITableViewCell {
    public typealias Action = () -> Void

    @IBOutlet private var button: UIButton!
    var buttonPressedAction: Action = {}

    override func awakeFromNib() {
        button.addTarget(self, action: #selector(buttonPressed(_:)), for: .touchUpInside)

    private func buttonPressed(_: UIButton) {

class CustomRow: Row<CustomTableViewCell> {
    public typealias Action = () -> Void

    private var buttonPressedAction: Action = {}

    init() {
            .nib(.init(nibName: "CustomTableViewCell", bundle: nil)),
            reuseIdentifier: NSStringFromClass(CustomTableViewCell.self)

    override func defaultCellConfiguration(_ cell: CustomTableViewCell, _ indexPath: IndexPath) {
        cell.buttonPressedAction = buttonPressedAction

    convenience init(_ action: @escaping Action) {
        buttonPressedAction = action

    func didButtonPress(_ action: @escaping Action) -> Self {
        buttonPressedAction = action
        return self

    private func buttonPressed() {

See example code to lean advanced usage.


Akira Matsuda, akira.matsuda@me.com


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


Stars: 17
Last commit: 6 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

45 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics