I would like to bind my
NSCollectionView to a datasource consisting of a
NSArray property. However, I wish to do this in code, as I have no XIBs in my UI for various technical reasons.
As Apple does not provide any documentation on how to do so, I’m looking for a canonical answer, giving a good representation on how this is supposed to be done.
It doesn’t matter if the answer is in Objective-C or Swift.
Here’s what doesn’t work:
contactsTableView.bind(NSContentBinding, toObject: myViewModel, withKeyPath: "contacts", options: nil)
With “contacts” being either a NSArrayController or NSArray with strings in.