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?