I'm getting EXC_BAD_INSTRUCTION in my viewDidLoad method with code EXC_I386_INVOP, subcode=0x0, when I'm tying to load delegate to UITableView.
Code looks like:
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
//MARK: PROPERTIES
@IBOutlet weak var playerTable: UITableView!
var players = [playerCell]()
override func viewDidLoad() {
super.viewDidLoad()
playerTable.delegate = self
playerTable.dataSource = self
players = [
playerCell(name: "Kogovsek K.", go: 0),
playerCell(name: "Novak J.", go: 0),
playerCell(name: "Doe J.", go: 0),
playerCell(name: "Unknown P.", go: 0),
]
}
...
}
I start controller with click on table view item in other controller and view on didSelectRowAtIndexPath
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let view = ViewController()
self.presentViewController(view, animated: true, completion: nil)
}
didSelectRowAtIndexPath
? Is that even feasible? – Sohil R. Memon