title: Adding two rows simultaneously in uitableview swift
body: <p>Sorry, I am very new to swift. I am trying to add two or more items in my array <code>animalsList</code> simultaneously and do an update in my tableview. How can I assign my indexPath to have two indeces? I tried to look for answers here but I can't find any. </p>
  
  <p>How can I update the table view if I add more items?</p>
  
  <pre><code>class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
  var animalsList = ["dog", "cat", "pig"];
  
  @IBOutlet weak var tableView: UITableView!
  
  @IBAction func click(_ sender: Any) {
      animalsList.append("horse");
      animalsList.append("mouse");
  
      let indexPath = IndexPath(row: animalsList.count - 1, section: 0);
      tableView.beginUpdates();
      tableView.insertRows(at: [indexPath], with: .none);
      tableView.endUpdates();
  
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return animalsList.count;
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = UITableViewCell(style: .default, reuseIdentifier: "cell");
      cell.textLabel?.text = animalsList[indexPath.row];
      return cell;
  }
  </code></pre>