Prepare (for: sender :) without receiving a call

I downloaded an Apple MyLife sample project and tried to create and run it using Xcode 8 beta 6.

There are two places where the view controller implemented the prepare(for:sender:) call to make the material before the storyboard session.

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

There is an error in this line: "The method does not cancel any method from its superclass."

If I remove the override, the application will be created, but the method will not be called when it is.

+6
source share
1 answer

The signature of the method has changed. sender now Any? instead of AnyObject?

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

This should be consistent with changes in how Swift connects to obj-c, described here in the section "New in Xcode 8 beta 6 - Swift Compiler"

+10
source

All Articles