The error log like below
2021-06-03 09:59:16.251029+0800 testing2[7167:2095191] [Storyboard] Unknown class _TtC8testing218NextViewController in Interface Builder file. Could not cast value of type 'UIViewController' (0x1d8c46428) to 'NextViewController' (0x102a90c50). 2021-06-03 09:59:16.252513+0800 testing2[7167:2095191] Could not cast value of type 'UIViewController' (0x1d8c46428) to 'NextViewController' (0x102a90c50). (lldb)
There is a link for my demo detail
https://drive.google.com/file/d/1LcY3hb3yGYf_3bZpo6qnvZPMviVp2Jft/view?usp=sharing
I am a noob, please detail to say the step~ Thank you
2
Answers
Solution 1
You can’t use
pushViewController
withoutnavigationController
.If you want you code will work, you need add
navigationController
to youViewController
.Click to your
ViewController
-> in upper menu selectEditor
-> chooseEmbed In
->Navigation Controller
.Solution 2
Add
Show
segue to yourNextViewController
.Then rename to
nextSegue
and change kind toPresent Modally
and set presentation toFull Screen
.In your
ViewController
:Swift class name has module name as prefix, Make sure your
ViewController
andNextViewController
both tick Inherit Module From Target with same module name in storyboard, giving theNextViewController
a identifier callnext
, and you can do the following code.