Search code examples
iosuitableviewswiftuiviewcontrolleruistoryboardsegue

SWIFT pass value to another existed ViewController


I have 2 ViewControllers. First one connected with second with 'Show'. When I click 'Add' button on the first - second will appear. Then I need to click on the cell in tableView (in the 2nd VC) and pass it's value to the label of the first VC and segue there.

I believe I should use prepareForSegue or tableView(..didSelectRowAtIndexPath..) funcs but I'm not sure how.


Solution

  • I found it. You need to use delegates. Look here: http://makeapppie.com/2014/07/01/swift-swift-using-segues-and-delegates-in-navigation-controllers-part-1-the-template/