1. Towing Line
Hold down the control key and use the mouse to start with a control on the source controller and drag it to the destination controller
2. Select the pop-up type and set Segue Identifier
In the popup dialog box, select "Selection segue->show"
See
Set Segue Identifier
3. Set the receiving pile in the destination view controller
class Detailviewcontroller:uiviewcontroller { ... var deststub:someclass! ...}
4. Writing data code in the Source view controller
OverrideFunc Prepareforsegue (Segue:uistoryboardsegue, sender:anyobject?)) { ifSegue.identifier = ="Seguename" { ifLet row = Tableview.indexpathforselectedrow?. Row {//here to get your data Let data = Yourmethod () let Detailviewcontroller= Segue.destinationviewcontroller as!detailviewcontroller detailviewcontroller.deststub = data }} }
iOS development-How to pass data from one Viewcontroller to another Viewcontroller (Swift code) by segue writing code