title: Two tables on one view in swift
body: <p>I have the following code to display two tables populated from two different arrays in one view:</p>
  
  <pre><code>@IBOutlet var RFTable: UITableView
      func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
  
      }
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.RFTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
      }
      func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -&gt; Int {
          return self.RFArray.count;
      }
      func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -&gt;     UITableViewCell! {
          var cell:UITableViewCell = self.RFTable.dequeueReusableCellWithIdentifier("cell") as     UITableViewCell
  
          cell.textLabel.text = String(self.RFArray[indexPath.row])
  
          return cell
      }
  
      @IBOutlet var IMProdTable: UITableView
      func tableView2(IMProdTable: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!)     {
  
      }
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.IMProdTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell2")
      }
      func tableView2(IMProdTable: UITableView!, numberOfRowsInSection section: Int) -&gt; Int {
      return self.IMProdArray.count;
      }
      func tableView2(IMProdTable: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -&gt;     UITableViewCell! {
          var cell2:UITableViewCell = self.IMProdTable.dequeueReusableCellWithIdentifier("cell2") as UITableViewCell
  
          cell2.textLabel.text = String(self.IMProdArray[indexPath.row])
  
          return cell2
      }
  </code></pre>
  
  <p>I got the first table working, and then copied and pasted the text, replacing the array names and tableview names, and have hooked up the delegate and datasource.  However Xcode displays 'invalid redeclaration of viewdidload' on the second (pasted) code. If I replace this to 'fund loadView() {' instead of viewdidload the app builds.  When I test it though, both tables view exactly the same data which is the data in 'RFArray.'  I am VERY new to coding and cannot see what I have done, please help.</p>