Easy-to-use library to build checkbox tree out of plain item models. Fully customizable.
- Swift 5
- iOS >= 13.0
- File > Swift Packages > Add Package Dependency
- Copy & paste this line then follow the instruction
https://github.com/aporohov/APCheckboxTree.git
Add this line to your Podfile and run pod install
pod 'APCheckboxTree'
// Create instance of tree view
let tree = APCheckboxTree()
// Setup items of checkbox tree
tree.items = [
APCheckboxItem(title: "Fruits",
children: [
APCheckboxItem(title: "Orange"),
APCheckboxItem(title: "Apple",
isSelected: true)
])
]
// Add tree on the superview then ...
extension MyViewController: APCheckboxTreeDelegate {
func checkboxItemDidSelected(item: APCheckboxItem) {
print(item)
}
}
// Disable items group open/close animation
tree.style.isCollapseAnimated = false
// Make tree items always visible
tree.style.isCollapseAvailable = false
tree.style.images.checkboxOn = UIImage(named: "icCheckboxOn")
tree.style.images.checkboxOff = UIImage(named: "icCheckboxOff")
tree.style.itemViewStyle.titleFont = .systemFont(ofSize: 16)
tree.style.itemViewStyle.minHeight = 54
tree.style.itemViewStyle.titleColor = .darkGray