I have the following loop in my code:
for i in 0..<array.count where newRow != i {
array{i].active = false
}
I would like to assign the selectedIndexPath.row to the variable newRow. Is that possible or is there a better way to make the loop ignore the current row I am on?
Thanks in advance for any help.
You are not showing enough info, so I may be missing something, but why won't you do it simply:
for i in 0..<todos.count where selectedIndexPath.row != i {
todos[i].activated = false
}
Or, when I want TO SET ACTIVATED TO TRUE IN THIS ROW AND FALSE IN ALL OTHER ROWS, I would write:
for i in 0..<todos.count {
todos[i].activated = (selectedIndexPath.row == i)
}