Hi,
I can’t seem to figure out what’s wrong with my prepare(for) method.
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
if segue.identifier == “AddItem” {
let navigationController = segue.destination as! UINavigationBar
let controller = navigationController.topViewController as! AddItemViewController
controller.delegate = self
}
}
Xcode gives me the error:
Yellow warning: Cast from UIViewController to unrelated type “UINavigationBar” always fails
Red: Value of type UINavigationBar has no member 'topViewController"