This code is swift 2
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let playerViewController = segue.destination as! PlayerViewController
playerViewController.videoID = channelsDataArray[selectedVideoIndex]["videoID"] as! String
}
Errors "Method does not override any method from its superclass"
Please solution for swift 3
In Swift 3 and later, it is prepare(for:sender:)
and the second parameter is Any
:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destination = segue.destination as? PlayerViewController {
destination.videoID = channelsDataArray[selectedVideoIndex]["videoID"] as! String
}
}
In the future, if you temporarily comment out your method and start to type prepare
, code completion will show you the proper method signature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With