just wondering how I would go about implementing didSelectRowAtIndexPath or something similar into my app. I have a populated Table View with several dynamic cells and basically I want to change Views once a certain cell is selected.
I am able to get my head around it in Obj-C, but there is nothing on google to help me with Swift! Any help would be appreciated as I am still learning
This is how I managed to segue from UITableView cells to other view controllers after implementing cellForRow, numberOfRowsInSection & numberOfSectionsInTable.
Will output:
You selected cell number: \(indexPath.row)!
Remember to match the identifier of your segue in story board to the identifier in the function, e.g
goToMainUI
.You can use
didSelectRowAtIndexPath
in Swift.For Swift 3 it's
Just make sure you implement the
UITableViewDelegate
.