Why is the nib still loaded even though the class has been registered with NSCollectionView?

I implemented a subclass of NSCollectionViewItem:

class ViewItem: NSCollectionViewItem {   
    override func loadView() {
        self.view = NSView()
    }
}

and registed to NSCollectionView:

class PictureFrameThemeListView: NSCollectionView {
    init(viewModel: PictureFrameViewModel) {
        super.init(frame: .zero)
        self.register(ViewItem.self, forItemWithIdentifier: .item)
    }

However, when calling makeItem(withIdentifier:for:), the following error is prompted:

FAULT: NSInternalInconsistencyException: -[NSNib _initWithNibNamed:bundle:options:] could not load the nib 'Item' in bundle NSBundle

What confuses me is that I registered the subclass of NSCollectionViewItem, why do NSCollectionView to init the NSNib?

Could you please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

You need to register your ViewItem after the layout has been set. Any class registered before the layout has been set is ignored.