Post

Replies

Boosts

Views

Activity

How to create NSCollectionView programatically?
I'm attempting to create an NSCollectionView (wrapped in a SwiftUI container) programmatically, however I repeatedly get a crash when dequeuing a reusable item (or supplementary view if the snapshot is empty). I used the Modern Collection Views sample code as reference, but don't see what I'm doing incorrectly. The code for the view Collection.swift - https://developer.apple.com/forums/content/attachment/b4aba30b-a2e0-44c8-b7ed-9ef0e0dd22d1 And the crash messages could not dequeue an item of kind: NSCollectionElementKindItem with identifier Cell - must register a nib or a class for the identifier, or name a nib or class to match the identifier could not dequeue a view of kind: ViewHeader with identifier Header - must register a nib or a class for the identifier, or name a nib or class to match the identifier which are particularly unhelpful as those are exactly the identifiers used during registration. I've also tried using nibs during registration, with the same results. Any insights would be greatly appreciated!
10
0
3.2k
Aug ’20