How to pass prepareForSegue: an object

后端 未结 10 2087
北荒
北荒 2020-11-21 11:18

I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview

10条回答
  •  太阳男子
    2020-11-21 11:36

    In Swift 4.2 I would do something like that:

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if let yourVC = segue.destination as? YourViewController {
            yourVC.yourData = self.someData
        }
    }
    

提交回复
热议问题