title: Access to array's indexPath in a function Swift
body: <p>I am trying to <strong>access an array's <code>indexPath</code></strong> inside a function to <strong>update this array's data</strong> but I don't know how to pass the <code>indexPath</code> as a parameter (espacially what to pass when calling) to the function or if this is even the solution.</p>
  
  <p>I included <code>cellForRowAt</code> to <strong>illustrate</strong> how this function access <code>indexPath</code>.</p>
  
  <pre><code>var cryptosArray: [Cryptos] = []
  
  extension WalletTableViewController: UITableViewDelegate, UITableViewDataSource, CryptoCellDelegate {
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let crypto = cryptosArray[indexPath.row]
  
          let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! WalletTableViewCell
          cell.setCrypto(crypto: crypto)
          cell.delegate = self
          cell.amountTextField.delegate = self
  
          return cell
      }
  
      func cellAmountEntered(_ walletTableViewCell: WalletTableViewCell) {
  
           if walletTableViewCell.amountTextField.text == "" {
              return
          }
          let str = walletTableViewCell.amountTextField.text
  
          let crypto = cryptosArray[indexPath.row] //&lt;---- How to do that?
  
          crypto.amount = walletTableViewCell.amountTextField.text
  
          //Then update array's amount value at correct index
  
  
          walletTableViewCell.amountTextField.text = ""
  
      }
  
  
  }
  </code></pre>