How to fix Unknown Class in Interface Builder when using SPM packages
I had a problem few days ago trying to use storyboards from a SPM package. I was unable to instantiate controllers from storyboard, even had the right class name and the right target module.
So… I googled it and I found a lot of posts about this problem.
Unknown class _TtC10MySPModule24ViewController in Interface Builder file.
- Like this: https://developer.apple.com/forums/thread/122947
- Like this: https://developer.apple.com/forums/thread/128834
- Like this: https://stackoverflow.com/questions/38846538/unknown-class-in-interface-builder/44066778
I tried all methods found on web but nothing worked… Until I found this thread:
Thanks to Karim I fixed my code
- Adding @objc(OBJCViewController) before my actual ViewController definition and…
- Replacing ViewController with OBJCViewController in storyboard.
👋 :)