title: how to toggle boolean value in swift for changing the button icon in tableview
body: <p>i had done this using dictionary .how to change the bool value in onClick method  while clicking each time . 
      //  delegate method </p>
  
  <pre><code>func onClick(index:Int){
  
     array[index]["status"] = true
      TableView.reloadData()
  
  
  }
  </code></pre>
  
  <p>// in tableview </p>
  
  <pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      let cell:TableViewCell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! TableViewCell
      let  dict = array[indexPath.row]
  
      cell.lab.text = dict["name"] as! String
      let status:Bool = dict["status"] as! Bool
      cell.index     =  indexPath.row
  
  
      if(status == true){
          cell.btn.setImage(UIImage(named: "checked"), for: .normal)
      }else{
         cell.btn.setImage(UIImage(named: "unchecked"), for: .normal)
      }
  
      cell.delegate = self
  
  
  
      return cell
  }
  </code></pre>