title: swift access tableview indexPath ouside
body: <p>I wanted to know how to access indexpath rows of a table view outside. I wanted to access on when a certain button is pressed which is outside. i have provided the code i have so far below , dont worry table is working fine just wanted to know how to access it outside. It keeps on returning index or cell# 0 when checkbuttonispressed.</p>
  
  <p>wanted to access it here what i have so far</p>
  
  <pre><code> func checkBoxButtonIsPressed(cell: ToDoListTableViewCell) {
          performSegue(withIdentifier: "updateChores", sender: nil)
  
          let indexPath = IndexPath(row: 0 , section: 0)
          let cell = tableView.cellForRow(at: indexPath)
          print("you selected cell #\(indexPath.item)!")
          //wanted to print selected row.
  
  
      }
  </code></pre>
  
  <p>what i want to access</p>
  
  <pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
            print("You selected cell #\(indexPath.item)!")
  
  
          if indexPath.row == (-1) {
  //            var a = loggedInUsername
  //            if ((a?.range(of: "mother")) != nil) {
  ////                performSegue(withIdentifier: "goToSegue", sender: nil)
  //                print("yolo")
  //            }else {
  //                print("do nothing")
  //                var alert = UIAlertController(title: "No Access", message: "You Can't Add A Chore", preferredStyle: UIAlertControllerStyle.alert)
  //                alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
  //                self.present(alert, animated: true, completion: nil)
  //            }
  
          } else {
  
  
              print("You selected cell #\(indexPath.item)!")
  
              if let getTempDetails: [String : Any] = getAllDetail[indexPath.row],
                  let name = getTempDetails["name"] as? String,
                  let id = getTempDetails["id"] as? Int,
                  let description = getTempDetails["desc"] as? String,
                  let chorereward = getTempDetails["reward"] as? String,
                  let choreschedule = getTempDetails["sched"] as? String
                  ...
  </code></pre>