I am trying to add a TableView
inside my UITableViewCellController
like this:
To add content to the cells i'm doing this:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if (tableView == groupPicker) {
var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "")
cell.textLabel?.text = "\(groups[indexPath.row]) - \(sets[indexPath.row]) Set\(ending(sets[indexPath.row]))"
return cell
}
let cell = tableView.dequeueReusableCellWithIdentifier("cell\(indexPath.section)") as UITableViewCell
return cell
}
groupPicker is my tableview inside the cell
I get this error:
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
on this line:
let cell = super.tableView.cellForRowAtIndexPath(indexPath)
Is there another way to do this, or am I doing something from?
(All my cells are static, I need the table view inside the cell to be dynamic)
Thanks in advance
UPDATED CODE:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if (indexPath.section == 0) {
var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "")
cell.textLabel!.text = "Text"
return cell
}
return tableView.dequeueReusableCellWithIdentifier("cell\(indexPath.section)") as UITableViewCell!
}
I get this: (lldb) Nothing else