Latest 1.2.3
Homepage https://github.com/EcolabCompany/StaticTableViewDatasource
License MIT
Platforms ios 11.0
Authors

Build Status

Overview

Quickly build static tableviews programmatically for iOS

Installation

  • Via Cocoapods

    pod StaticTableViewDatasource

Instructions

  • First, create an instance of a StaticTableViewDatasource

    var datasource = StaticTableViewDatasource()
    
  • Then, create a section with an optional header and footer title

    datasource.addSection("Section Title", footer: "Section Footer") { section in
    
    }
  • For each section, you can add cells by calling

    section.addCell({
     let cell = UITableViewCell()
     cell.textLabel?.text = "This cell has no action associated with it"
     return cell
    })
  • You can also set an action if a cell is selected

    section.addCell({
    let cell = UITableViewCell()
    cell.textLabel?.text = "This cell has an action associated with it"
    return cell
    }, didSelect: { 
    print("Cell Selected")
    })

Example

datasource.addSection(nil) { section in
  section.addCell({
        let cell = UITableViewCell()
        cell.textLabel?.text = "This is the First Cell"
    return cell
   })
}

datasource.addSection("2nd Section Title", footer: "2nd Section Footer") { section in
    section.addCell({
        let cell = UITableViewCell()
        cell.textLabel?.text = "This cell has no action associated with it"
        return cell
    })

    section.addCell({
        let cell = UITableViewCell()
    cell.textLabel?.text = "This cell has an action associated with it"
        return cell
    }, didSelect: { 
        print("Cell Selected")
    })
}

Latest podspec

{
    "name": "StaticTableViewDatasource",
    "version": "1.2.3",
    "swift_version": "4.2",
    "summary": "Create static table views in a declarative style",
    "homepage": "https://github.com/EcolabCompany/StaticTableViewDatasource",
    "license": "MIT",
    "authors": {
        "Nate Mann": "[email protected]"
    },
    "social_media_url": "https://twitter.com/NathanMann",
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/EcolabPestServices/StaticTableViewDatasource.git",
        "tag": "1.2.3"
    },
    "source_files": "StaticTableViewDatasource/StaticTableViewDatasource/*.swift"
}

Pin It on Pinterest

Share This