Skip to content

kennic/NKTableView

Repository files navigation

NKTableView

A block-based TableView to replace UITableView's delegate and dataSource for shorter code and easier to use

let tableView = NKTableView(frame: .zero, style: .plain)
		
tableView.tableDataSource
	.numberOfRowsInSection { section in 1 }
	.cellForRowAt { tableView, indexPath in tableView.dequeueReusableCell(withIdentifier: "cell") ?? UITableViewCell(style: .default, reuseIdentifier: "cell") }
		
tableView.tableDelegate
	.willDisplayCell { cell, indexPath in configCell(cell) }
	.didSelectRowAt { indexPath in showDetails(indexPath) }
	.heightForRowAt { indexPath in 50.0 }

Installation

NKTableView is available through Swift Package Manager (Recommended) and CocoaPods:

Regardless, make sure to import the project wherever you may use it:

import NKTableView

Cocoapods:

NKTableView can be installed as a CocoaPod. To install, include this in your Podfile.

pod "NKTableView"

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into Xcode and the Swift compiler. This is the recommended installation method. Updates to FrameLayoutKit will always be available immediately to projects with SPM. SPM is also integrated directly with Xcode.

If you are using Xcode 11 or later:

  1. Click File
  2. Add Packages...
  3. Specify the git URL for NKTableView.
https://github.com/kennic/NKTableView.git

About

A block-based TableView to replace UITableView's delegate and dataSource for shorter code and easier to use

Resources

License

Stars

Watchers

Forks

Packages

No packages published