Satsuki Satsuki - 1 year ago 193
Swift Question

Could not cast value of type 'UIViewController'

I am trying to implement BWWalkthrough in my project. However I get an error stating

Unknown class _TtC20BWWalkthroughExample27BWWalkthroughViewController in Interface Builder file.
Could not cast value of type 'UIViewController' (0x195bca580) to 'AppName.BWWalkthroughViewController' (0x10042c3a0).
(lldb)


It is pointing at the below code

let walkthrough = stb.instantiateViewControllerWithIdentifier("walk") as! BWWalkthroughViewController


I don't know why this is happening, any help is appreciated, Thank you.

Also feel free to ask more code from my project.

Answer Source

Your storyboard doesn't seem to be linked to a BWWalktroughViewController. Find where the view controller should be a BWWalktroughViewController, and check if it is one.