How to fix Unknown Class in Interface Builder when using SPM packages

Marius Ilie
Jan 25, 2021

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.

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.

👋 :)

--

--