ios - Could not cast value of type 'UINavigationController' to 'jacrs_ios.TopViewController' -
i'm new swift , trying make side menu base on tutorial following ran across error. "could not cast value of type 'uinavigationcontroller' (0x1026054a8) 'jacrs_ios.topviewcontroller' (0x1009ac510)." noticed there same problems existing here still dont understand. i'm gonna included current storyboard in case did wrong. thanks.
viewcontroller error
override func prepare(for segue: uistoryboardsegue, sender: any?) { let topviewcontroller = segue.destination as! topviewcontroller topviewcontroller.stringpassed = username.text! }
storyboard
try this
if let navigationcontroller = segue.destination as? uinavigationcontroller { let topviewcontroller = navigationcontroller?.topviewcontroller as! topviewcontroller topviewcontroller.stringpassed = username.text! }
Comments
Post a Comment