Unknown class name in IB file

I have a mixed-language project that began in Objective-C, but later we started using Swift for new classes.


In the Objective-C code, there is a custom collection view cell with its own XIB file. When used from a view controller that is also in Obj-C, it works fine.


However, when we try to use the cell in a Swift view controller, we see this error at the point where we try to dequeue a cell:


2020-01-14 18:53:36.505132-0600 UMIXX[24947:3977729] [Storyboard] Unknown class _TtC5UMIXX22SongCollectionViewCell in Interface Builder file.


The name of our cell is "SongCollectionViewCell", not "_TtC5UMIXX22SongCollectionViewCell", so it is unsurprising that a class with this name can't be found, but we have no idea where this name is coming from. I'm guessing it's due to some kind of Obj-C class name mangling, but I can't figure out what to do about it.


Thanks,

Frank

Replies

_TtC5UMIXX22SongCollectionViewCell is just an internal name given by compiler, to make sure it is a unique name. But it points to SongCollectionViewCell.


So, that's not the problem IMO.

_TtC5UMIXX22SongCollectionViewCell


It is an internal name for a Swift class `UMIXX.SongCollectionViewCell`. (`UMIXX` is a module name, and may be the project name of yours.)


So, if you hava the Swift class in your project, it may not be a problem.


If you want to use an Obj-C class `SongCollectionViewCell`, you may need to check the Custom Class settings in your storyboard.


Custom Class


Class [ SongCollectionViewCell ]

Module [ None ] ← Make this empty (shown as None in gray)

[ ] Inherit Module From Target ← Uncheck