title: loading tableview from 2 different arrays
body: <p>I have 2 coredata arrays. One has 3 elements and the other one also has 3 elements. Now I want to load in my tableview both these arrays. So I'll have a total of 6 rows in my tableview.</p>
  
  <p>This I have achieved like so...</p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      let totalCount = (customerDetails.count) + (customerDetails2.count)
      return totalCount
  }
  </code></pre>
  
  <p>And the data of these two arrays I tried loading like so in the <code>cellForRowAt...</code></p>
  
  <pre><code>    let customers = customerDetails[indexPath.row]   //CRASHES HERE
      for i in 0..&lt;(customerDetails.count) {
          cell.nameLabel.text = customers.fname
          if i == customerDetails.count {
              break
          }
      }
      let customers2 = customerDetails2[indexPath.row] 
      for i in 0..&lt;(customerDetails2.count) {
          cell.nameLabel.text = customers2.fname
          if i == customerDetails2.count {
              break
          }
      }
  </code></pre>
  
  <p>But it crashes at the line mentioned saying <code>Index out of range</code> possibly because <code>customerDetails</code> has only 3 rows while the total cells loaded is 6. </p>
  
  <p>What can be done in such a case..?</p>