I ran into the following error
Unknown class TutorialViewController.swift in Interface Builder file.
when renaming the default files Main.storyboard
and ViewController.swift
to my desired naming convention of TutorialView.storyboard
and TutorialViewController.swift
respectively.
I renamed the files by physically renaming the file names in Xcode and updating the class name of TutorialViewController.swift
.
After renaming, I tried to fix the link from TutorialView.storyboard
to TutorialViewController.swift
by updating the storyboard's Custom Class
to TutorialViewController
, which is the correct way to complete the link. This in fact caused the above error.
Disclaimer: I'm aware this is similar to this SO post but I wanted to make this question and answer my solution, as that post does not have an accepted answer. I'm hoping I can save someone all the time it took me to figure this out.
Check if the Inherit from Target
is selected in the interface builder to your custom view. That actually did the trick for me.
If your view happens to be within a .bundle
file that gets copied to a different target, then you'll need to explicitly set the module target.
If you have multiple targets, then check if the custom class is selected for all the targets or at least the one which you are running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With