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

storyboard

try this

if let navigationcontroller = segue.destination as? uinavigationcontroller {   let topviewcontroller = navigationcontroller?.topviewcontroller as! topviewcontroller  topviewcontroller.stringpassed = username.text!  } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -