Exactly, as you say in the commentary, these two tables are not Controllers, so you can not associate a controller class with each one. If you want to manipulate and populate those tables you can do it from the main ViewController itself, I'll give you an example:
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
// MARK: Propiedades
@IBOutlet weak var tableView1: UITableView!
@IBOutlet weak var tableView2: UITableView!
// Datos para popular las tablas
let muestraDatos1 = ["Uno", "Dos", "Tres", "Cuatro"]
let muestraDatos2 = ["Uno", "Dos", "Tres", "Cuatro", "Cinco", "Seis", "Siete"]
// MARK: Metodos
override func viewDidLoad() {
super.viewDidLoad()
// Puedes hacer la asociacion aqui o en el storyboard
tableView1.dataSource = self
tableView1.delegate = self
tableView1.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell1")
// Puedes hacer la asociacion aqui o en el storyboard
tableView2.dataSource = self
tableView2.delegate = self
tableView2.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell2")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView == self.tableView1 {
return muestraDatos1.count
} else {
return muestraDatos2.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell: UITableViewCell
if tableView == self.tableView1 {
cell = tableView.dequeueReusableCellWithIdentifier("cell1", forIndexPath: indexPath)
let dato = muestraDatos1[indexPath.row]
cell.textLabel!.text = dato
} else {
cell = tableView.dequeueReusableCellWithIdentifier("cell2", forIndexPath: indexPath)
let dato = muestraDatos2[indexPath.row]
cell.textLabel!.text = dato
}
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("seleccionada fila: \(indexPath.row) ")
}
}