title: Passing Data to a tableViewController depending on button that was pressed
body: <p>i'm a beginner in swift, but I do have a decent background in HTML,CSS, and some Java. I made this account to literally just ask this question, so i'll get straight to the point.</p>
  
  <p>I really enjoy swift, but i've literally spent a f*cking week writing this same code over and over again, reviewing countless tutorials, books, guides, etc. To no avail; and i'm not going to lie, i'm getting reaaaaally tired of seeing 10+ errors stack up in my compiler as I keep trying to figure this out.</p>
  
  <p>I have a ViewController, and I have a TableViewController - the ViewController being my home screen. On said viewController, I have two buttons, one is for BuildingItems, the other is BuildingBlocks. Both of which are segues. </p>
  
  <p>on my TableViewController, I have buildBlocks and buildItems, both of which have their arrays defined.</p>
  
  <p>What i'm trying to do, is depending on the button the user chose, I want that to then be the data that's used to populate my tableview. I can populate the tableview specifically by using the normal cell.textLabel?.text = arrayNameHere[indexPath.row] but obviously that doesn't solve my problem.</p>
  
  <p>I hope that you're able to help me out here. I apologize for the crappy grammar and formatting, i've literally spent 4-5 hours a day this passed week trying to get this to work, and i've ended up just getting angry and deleting my entire project three different times. I'll include the code below. Again, excuse the formatting. I dont know why I can't seem to figure out swift, I keep trying every variation of delegate to try and pass something over that will let it work, but nothing is working.</p>
  
  <p><strong>ViewController:</strong> </p>
  
  <pre><code>@IBAction func BuildItems (_sender: Any) {
  }
  
  @IBAction func BuildBlocks (_sender: Any) {
  }
  </code></pre>
  
  <p><strong>In TableViewController:</strong></p>
  
  <pre><code>    let buildItems = ["these are all my", "arrays for this"]
  
      let buildBlocks = ["same thing here","just saving time"]
  
      class TableViewController: UITableViewController {
  
          var myIndex = 0
  
          override func tableView(_ tableView: UITableView, numberOfRowsInSection: Int) -&gt; Int {
          return buildItems.count
      }
  
      override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let cell = tableView.dequeueReusableCell(withIdentifier: "cell" for: indexPath)
  
          cell.textLabel?.text = buildItems[indexPath.row]
  
          return cell
      }
  
  
      override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          myIndex = indexPath.row
  
      }
  }
  </code></pre>