title: How to load tableview dynamically in swift 4
body: <p><a href="https://i.stack.imgur.com/v0wfJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v0wfJ.png" alt="enter image description here"></a>I have used Worm Tab Strip cocoapod to get tabs like android, the name of tabs are from server response, I need n number of view controllers based on the number of tab names.</p>
  
  <p>For testing purpose, I have hardcoded tab names, and for each particular tab name, I have another array of sub names. My question is how do I change the tableview contents so that, I get an exact number of sub names according to the tab names </p>
  
  <pre><code>var tabNames = ["Brands", "Sports","Movies", "Mobile","Games"]
  var brandsNames = ["Addidas", "Nike","Puma"]
  var sportsName = ["Cricket","Fifa","Hockey","Baseball"]
  var moviesName = ["Mission Impossible","Matrix","Avatar","Titanic"]
  var mobileNames = ["Nokia","Redmi","Samsung"]
  var gameNames = ["FIFA 19","PES 19","WWE 2K19","Max Payne"]
  </code></pre>
  
  <p>What should i try in </p>
  
  <pre><code>func tableView(_ tableView: UITableView, numberOfRowsInSection 
  section: Int) -&gt; Int {
  
     // return fruits.count
      }
  </code></pre>
  
  <p>And</p>
  
  <pre><code> func tableView(_ tableView: UITableView, cellForRowAt indexPath: 
  IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "cell", 
  for: indexPath) as! Cell1
      //cell.textLabel?.text = fruits[indexPath.row]
  
      return cell
      }
  </code></pre>
  
  <p>I need to get for Brands tab, I need brandsNames as tableview 
      contents.</p>
  
  <p>The tableview contents must change according to the tab names.</p>