This question went through quite late, and I thought it was an interesting design problem.
If you havenโt cracked it or liked any of your solutions:
I would suggest writing a subclass of NSCollectionViewItem that observes the key path self.representedObject and updates its presentation and subview when the model object changes.
NSCollectionViewItem is an NSViewController that implies that it must be responsible for managing its views. You can respect this by having the presentation layer with which it works as a representation of the model object that is facing the user contained in the property of the presented object. Thus, observing all the necessary properties of the model using KVO, you should have a neat place to invoke all the viewing operations related to the "rendering" of the model. In this sequence, you should have full control over whether you want to work with the NSView API or the CALayer API.
Depending on how difficult the presentation of your prototype element is, the size and volatility of the element set, the requirements for the "liveliness" of the user interface and other factors, you can leave with a very coarse-grained observation or you need a very fine-grained one - I hope you're used to working with the API KVO!
I also want to hear what choices you made at the end.
source share