Ios Swift UIAlertAction segue数据传递

Ios Swift UIAlertAction segue数据传递,ios,swift,segue,uialertaction,Ios,Swift,Segue,Uialertaction,我正在使用UIAlertAction询问用户是否希望转到该用户配置文件。不确定我做错了什么,因为数据没有正确传递并返回nil。不确定我是否需要在UIAlertAction之外使用“prepareForSegue”。。。我猜在当前设置下,segue在数据之前通过 let profileAction = UIAlertAction(title: "Go To Profile", style: UIAlertActionStyle.default, handler: { action in self.

我正在使用UIAlertAction询问用户是否希望转到该用户配置文件。不确定我做错了什么,因为数据没有正确传递并返回nil。不确定我是否需要在UIAlertAction之外使用“prepareForSegue”。。。我猜在当前设置下,segue在数据之前通过

let profileAction = UIAlertAction(title: "Go To Profile", style: UIAlertActionStyle.default, handler: { action in self.performSegue(withIdentifier: "followingfeed", sender: self)

        let dataPass = self.feeds[sender.tag].dataPass

        func prepare(for segue: UIStoryboardSegue, sender: Any?) {
            super.prepare(for: segue, sender: sender)
            if segue.identifier == "followingfeed" {

                    let user = dataPass
                    let controller = segue.destination as? ExploreBusinessProfileSwitchView
                    controller?.otherUser = user

            }
        }
    })

prepareforsgue
应该是类的实例方法

let profileAction = UIAlertAction(title: "Go To Profile", style: UIAlertActionStyle.default, handler: { action in 
  self.performSegue(withIdentifier: "followingfeed", sender:self.feeds[sender.tag].dataPass)
})
//


“otherUser”是一个NSDictionary,因此“User”不起作用。请用您想要的内容替换它。最好是快速的措辞或[string:Any]抱歉,我习惯于在“prepareForSegue”中设置数据,所以我不确定您何时说“用我想要的内容替换它”。非常感谢。我学到了一些新东西,这很管用!开发一些应用程序后,创建一份格式良好的简历,将其插入并发送给您所在国家的公司
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   super.prepare(for: segue, sender: sender)
     if segue.identifier == "followingfeed" {
         let user = sender as! [String:Any]
         let controller = segue.destination as? ExploreBusinessProfileSwitchView
         controller?.otherUser = user 
     }
}