MultiHeaderTableView
A simple library written in Swift.
Usage
MultiHeaderTableView provides a method to set the data:
public func set(sections: [MHSection])
MultiHeaderTableView provides the MultiHeaderTableViewDelegate.
public protocol MultiHeaderTableViewDelegate {
var cells: [UITableViewCell.Type] { get }
func cellForRowAt(tableView: UITableView, indexPath: IndexPath, row: MHRow) -> UITableViewCell
func didSelectRowAt(row: MHRow, indexPath: IndexPath)
var areSectionsExpandable: Bool { get }
var shouldMoveToNextSection: Bool { get }
}
You need to provide:
- cells your table view cells.
- areSectionsExpandable This field will be used to enable the functionality to hide/show cells when the end user clicks on the header. When you click on the header, all sub rows will be hidden/showed.
- shouldMoveToNextSection This field will be used to enable the functionality to move the table view to the next available heading.
- cellForRowAt Implement this method to provide the cell for a row at a certain index path. Example.
- didSelectRowAt This function will be invoked when the user did select a row at a certain index path.
Examples
You can find the Demo 📁 MultiHeaderTableViewDemo
.
Installation
Swift Package Manager
File > Add Package Dependencies...
Add https://github.com/edinsalimovic/MultiHeaderTableView.git
Requirements
- iOS 8.0+
License
MultiHeaderTableView is released under the MIT license. See LICENSE for details.