[ad_1]
I’ve a tableview cells, and the titles I get from server. Titles are array of strings. The info is drawing like this
- All knowledge
- Listing merchandise
- Coffees
- Teas
- Dessert
- Most important dishes
once I click on on every of those I can simply choose them and deselect, that half works good. Now i need that when i choose Listing merchandise, Coffees, teas, dessert, fundamental dishes collectively, these 5 objects can be deselected and all knowledge(first cell) can be chosen routinely.
I do know i ought to write this in didselect methodology, solely i dont know how one can write logic appropriately. Please assist me to unravel this. Thanks
that is my code instance
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
guard let isSelected = arrayOfTitles[indexPath.row].isSelected else {arrayOfTitles[indexPath.row].isSelected = true; return}
arrayOfTitles[indexPath.row].isSelected = !isSelected
filter?.values?[indexPath.row].isSelected = !isSelected
for i in 1..<arrayOfTitles.depend {
if arrayOfTitles[i].isSelected == isSelected {
arrayOfTitles[0].isSelected = isSelected
arrayOfTitles[i].isSelected = !isSelected
}
}
}
[ad_2]
