Swift 2 to 3 Migration for prepareForSegue [duplicate]

北城余情 提交于 2019-11-26 17:20:38

问题


This question might have been answered already but I could not find it.

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
}

This code worked fine in swift 2 but now gives me an error to remove the override.

Exact Error: "Method does not override any method from its superclass"

What is the new correct method for swift 3 for this? I can't seem to find any documentation on it anywhere.


回答1:


Method signature is changed in swift 3.0

Replace this

 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

With

 override func prepare(for segue: UIStoryboardSegue, sender: Any?) {


来源:https://stackoverflow.com/questions/39743365/swift-2-to-3-migration-for-prepareforsegue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!