0

What's wrong with my code? I keep getting this error, I don't know why it says method cannot be an @objc override because the type of parameter 2 cannot be represented in Objective-C.

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.

    let vc = segue.destinationViewController as! MovieViewController
    if let indexPath = self.tableView.indexPathForSelectedRow{
        let item = TableData[indexPath.row]
        vc.senddMovie = item
    }
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

1

it's because of the "Any?" in the function signature. it is a swift only type and can not be bridged to Objective-C.

see this answer discussing the issue : https://stackoverflow.com/a/26366289/4264079

SRTWarrior
  • 43
  • 9