问题
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