SelectionList
  • October 7, 2023

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

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


  • iOS 9.0+
  • Xcode 9+

Installation


CocoaPods

pod ‘SelectionList’

Legacy versions:

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

Swift Package Manager

dependencies: [
.package(url: “https://github.com/yonat/SelectionList”, from: “1.4.2”)
]

GitHub


View Github

#checkbox #checklist #radiobutton #radiobuttons #selectionmenu #swift #uitableview
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS