title: How can I access IndexPath in this case?
body: <p>How can I access IndexPath in this case? I want to use it in the button tapped function. I have indicated It there where I need it.</p>
  
  <p>EDIT:
  I have a comment button and a textfield below the tableView and if I click the button I want that it appends to the array</p>
  
  <pre><code>class Comments: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
      var comments = [MyPost]()
  
      @IBOutlet weak var tableView: UITableView!
      @IBOutlet weak var textield: UITextField!
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return comments.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "commentCell", for: indexPath)
  
          cell.textLabel?.text = comments[indexPath.row].comments
          return cell
      }
  
      @IBAction func postCommentButton(_ sender: UIButton) {
  
  
          comments[**here I need IndexPath**].comments = textield.text
  
          tableView.reloadData()
      }
  
  }
  </code></pre>
  
  <p>MyPost class:</p>
  
  <pre><code>class MyPost {
  
  var likes: Int16
  var image: String?
  var comments: String?
  var hasLiked: Bool?
  
  init(likes: Int16, image: String, comments: String, hasLiked: Bool) {
      self.likes = likes
      self.image = image
      self.comments = comments
      self.hasLiked = hasLiked
  }
  </code></pre>
  
  <p>}</p>