Swift3 segue发送数组到目标VC swift 3

Swift3 segue发送数组到目标VC swift 3,swift3,segue,Swift3,Segue,我正在尝试使用swift 3中的新viewcontroller。我还试图向新的viewcontroller发送一个数组,我也在以编程方式进行此操作。以下是我的segue的代码: performSegue(withIdentifier: "AlbumSegue", sender:self) { let destinationVC = segue.destination as! DestinationViewController destinatio

我正在尝试使用swift 3中的新viewcontroller。我还试图向新的viewcontroller发送一个数组,我也在以编程方式进行此操作。以下是我的segue的代码:

performSegue(withIdentifier: "AlbumSegue", sender:self) {
            let destinationVC = segue.destination as!  DestinationViewController
            destinationVC.recievedArray = selectedAlbumArray
我得到的错误是“调用中的额外参数'Sender'”

因此,如果我取出发送者部分,我的代码变成:

performSegue(withIdentifier: "AlbumSegue") {
            let destinationVC = segue.destination as! DestinationViewController
            destinationVC.recievedArray = selectedAlbumArray
            }
然后我得到一个错误,说“使用未解析的标识符'segue'”

但我发现了如下代码示例:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    let destinationVC = segue.destination as! DestinationViewController
    destinationVC.receivedString = stringToPass
    }
}

基本上,这两个问题都在模板中,所以我不知道为什么会出现这两个错误,因为根据StackOverflow上的回答,这些根本不是错误

代码示例是prepare()而不是preformSegue(),因此这些函数在一件事上是不同的。这个问题已经被问了很多次了:@DanielLegler我明白了,你能给我指一个performeSegue()教程,而不是一个可以传递变量的prepare吗?或者只能通过prepare()传递数组?prepare(forSegue:)在segue发生之前被调用。所以,当你调用performsgue时,它将首先执行准备中的任何内容(例如:)我明白了,这是一个两部分的事情,我基本上将它们划分为一部分,很抱歉重复这个问题,但这回答了为什么我找不到关于它的任何内容lol我感谢你的耐心