         var isChecked = false
         
         if indexPath.row == 0 {
-            isChecked = row0checked
+            isChecked = row0item.checked
         } else if indexPath.row == 1 {
-            isChecked = row1checked
+            isChecked = row1item.checked
         } else if indexPath.row == 2 {
-            isChecked = row2checked
+            isChecked = row2item.checked
         } else if indexPath.row == 3 {
-            isChecked = row3checked
+            isChecked = row3item.checked
         } else if indexPath.row == 4 {
-            isChecked = row4checked
+            isChecked = row4item.checked
         }
         
         if isChecked {

    
    // MARK: - table view delegate
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
            if let cell = tableView.cellForRowAtIndexPath(indexPath) {
                var isChecked = false
                if indexPath.row == 0 {
                    row0checked = !row0checked
                    isChecked = row0checked
                } else if indexPath.row == 1 {
                    row1checked = !row1checked
                    isChecked = row1checked
                } else if indexPath.row == 2 {
                    row2checked = !row2checked
                    isChecked = row2checked
                } else if indexPath.row == 3 {
                    row3checked = !row3checked
                    isChecked = row3checked
                } else if indexPath.row == 4 {
                    row4checked = !row4checked
                    isChecked = row4checked
                }
            
                if isChecked {
                    cell.accessoryType = .Checkmark
                } else {
                    cell.accessoryType = .None
                }
            }
            
            tableView.deselectRowAtIndexPath(indexPath, animated: true)
    }

import UIKit

class CheckListViewController: UITableViewController {
    var row0item: ChecklistItem
    var row1item: ChecklistItem
    var row2item: ChecklistItem
    var row3item: ChecklistItem
    var row4item: ChecklistItem
    
    // MARK: - init
    required init?(coder aDecoder: NSCoder) {
        row0item = ChecklistItem()
        row0item.text = "Walk the dog"
        row0item.checked = false
        
        row1item = ChecklistItem()
        row1item.text = "Brush my teeth"
        row1item.checked = true
        
        row2item = ChecklistItem()
        row2item.text = "Learn iOS development"
        row2item.checked = true
        
        row3item = ChecklistItem()
        row3item.text = "Soccer practice"
        row3item.checked = false
        
        row4item = ChecklistItem()
        row4item.text = "Eat ice cream"
        row4item.checked = true
        
        super.init(coder: aDecoder)
    }
    
    // MARK: - life cycle
    override func viewDidLoad() {
