I'm about to implement that when there is a child that is not expandable, then return selected cell + collapse whole treeView.
But when I call collapseAllRows() in didSelectRowAt, there goes a crash.
You can replicate that in demo project by adding:
func treeView(_ treeView: CITreeView, didSelectRowAt treeViewNode: CITreeViewNode, at indexPath: IndexPath) {
guard let cellData = treeViewNode.item as? CITreeViewData else {fatalError()}
if cellData.children.isEmpty {
self.sampleTreeView.collapseAllRows()
}
}
Pod version: 1.6.1
Then tap Sedan -> Alfa Romeo.
After that there goes "Index out or range error" in setExpandTreeViewNode of CTTreeViewController.