我的代码有什么问题?方法不能是@objc



我的代码怎么了?我一直遇到此错误,我不知道为什么它说方法不能成为@OBJC覆盖,因为参数2的类型无法在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
    }
}

这是因为"任何?"在功能签名中。它是仅仅是迅速的类型,无法桥接到Objective-C。

请参阅此答案讨论问题:https://stackoverflow.com/a/26366289/4264079

最新更新