Row checked checklist app


I have a question about the checklist app.

So i made the variable row0checked = false.
row1checked = false

And use the ! to make it true when the row is tapped.
Now the variable row0checked = true right?

But then for the checkmark:

var isChecked = false

    if indexPath.row == 0 {
        isChecked = row0checked
    } else if indexPath.row == 1 {
        isChecked = row1checked
    } else if indexPath.row == 2 {
        isChecked = row2checked
    } else if indexPath.row == 3 {
        isChecked = row3checked
    } else if indexPath.row == 4 {
        isChecked = row4checked
    if isChecked {
        cell .accessoryType = .Checkmark
    } else {
        cell .accessoryType = .None

You make ischecked false with the var.
but the line: isChecked = row0checked. If the row0checked is selected so the value becomes true for that row right?
but does this line " isChecked = row0checked" make the variable for isChecked true when row0checked is true? ore do i have it rong ?

The code you quoted is only responsible for displaying the checklist, if I remember correctly:

if indexPath.row == 0 {
        isChecked = row0checked

For one row (0 to 4) this code sets the local isChecked variable to the value of the corresponding rowXchecked.

Afterwards – depending on the value of isChecked – a checkmark is displayed in this cell/row.

So isChecked = row0checked copies the value of row0checked into the local variable isChecked.

Changing the value of rowXchecked when a row is selected has to happen somewhere else.

Oke thank you for the help!