Set an identifier to the segue in your storyboard (click on the segue and then on the right menu go to attributes inspector) and then you probably need to click on the cell to make the segue in didSelectRowAt
, do this in there:
self.performSegue(withIdentifier: "YOUR IDENTIFIER", sender: DATA TO PASS or nil)
And then create the segue function
override func prepare(for segue: UIStoryboardSegue, sender: Any!){
if (segue.identifier == "YOUR IDENTIFIER") // good to have if you have multiple segues
{
let secondVC = segue.destination as! SecondViewController
secondVC.str = "DATA" // now you can access public variables and functions from the second viewController
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…