Want to achieve something like this-

I want to reload cells on cell click in order to check the box and fetch the checkbox values.
In DidSelectRowAtIndexPath i am doing like this-
func expandableTableView(_ expandableTableView: LUExpandableTableView, didSelectRowAt indexPath: IndexPath) {
print("Did select cell at section \(indexPath.section) row \(indexPath.row)")
let cell = expandableTableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier, for: indexPath) as! FilterTableCell
self.expandableTableView.beginUpdates()
cell.setSelected(true, animated: true)
self.expandableTableView.reloadRows(at: [indexPath], with: .automatic)
self.expandableTableView.endUpdates()
}
and Inside Cell for row at index path if i am checking if cell is selected or not. It always says not selected-
func expandableTableView(_ expandableTableView: LUExpandableTableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = expandableTableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as? FilterTableCell else {
assertionFailure("Cell shouldn't be nil")
return UITableViewCell()
}
if cell.isSelected{
print("selected")
}
else{
print("not selected")
}
cell.label.text = "\(self.FilterValueArray.object(at: indexPath.row))" + " (" + "\(self.FilterCountArray.object(at: indexPath.row))" + ")"
return cell
}
BTW if i am checking like this inside CellForRowAtIndexPath() it shows cell is selected but with this i can't access my Cell properties.
if let cell = expandableTableView.cellForRow(at: indexPath) {
if cell.isSelected {
print("This cell is selected")
// cell.button.setImage(UIImage(named: "CheckboxUnchecked"), for: .normal)
}
else{
print("This Cell is not selected")
// cell.button.setImage(UIImage(named: "CheckboxUnchecked"), for: .normal)
}
}
So could u assist me on this that how can i work out my cell selection issue?
Want to achieve something like this-

I want to reload cells on cell click in order to check the box and fetch the checkbox values.
In DidSelectRowAtIndexPath i am doing like this-
and Inside Cell for row at index path if i am checking if cell is selected or not. It always says not selected-
BTW if i am checking like this inside CellForRowAtIndexPath() it shows cell is selected but with this i can't access my Cell properties.
So could u assist me on this that how can i work out my cell selection issue?