Home

Awesome

SelectionList

Simple single-selection or multiple-selection checklist, based on UITableView.

Swift Version Build Status License CocoaPods Compatible
Platform PRs Welcome

<p align="center"> <img src="Screenshots/SelectionList.png">&nbsp;&nbsp;&nbsp;&nbsp;<img src="Screenshots/SelectionListStandard.png"> </p>

Usage

let selectionList = SelectionList()
selectionList.items = ["One", "Two", "Three", "Four", "Five"]
selectionList.addTarget(self, action: #selector(selectionChanged), for: .valueChanged)
selectionList.selectedIndex = 3

Multiple Selection

selectionList.allowsMultipleSelection = true
selectionList.selectedIndexes = [0, 1, 4]

Changing Appearance

The following properties can be changed either in Interface Builder or in code:

selectionList.selectionImage = UIImage(named: "v")
selectionList.deselectionImage = UIImage(named: "o")
selectionList.isSelectionMarkTrailing = false // to put checkmark on left side
selectionList.rowHeight = 42.0

You can do additional styling in code:

selectionList.setupCell =  { (cell: UITableViewCell, index: Int) in
    cell.textLabel?.textColor = .gray
}

If you want to remove the cells seperators

selectionList.tableView.separatorStyle = .none

Requirements

Installation

CocoaPods:

pod 'SelectionList'

Legacy versions:

Swift versionSelectionList version
4.1 (Xcode 9.4)pod 'SelectionList', '~> 1.2.0'
4.0pod 'SelectionList', '~> 1.0.2'

Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/yonat/SelectionList", from: "1.4.5")
]

Meta

@yonatsharon

https://github.com/yonat/SelectionList