So I've always wanted to code a program for OSX with Swift that needs a Collection View. As it is for OSX, it doesn't use a UICollectionView but a NSCollectionView (by the way, if you know any tutorial to use these with Swift it'll be much appreciated !).
The thing is : I put a 'Collection View' in my storyboard, make it my initial controller, and as the view was created it also created a NSCollectionViewItem on the storyboard. In Xcode 6 the prototype item was absolutely not related to any other element of the storyboard, but now in Xcode 7 it is created with a 'Prototype Segue'.
Problem : When I compile, I've got this error :
Unknown segue relationship : Prototype
Anyone has an idea on how to fix it ?
Thanks in advance, and sorry for my english --'
It seems you have to specify connection manually.
Add the following code to viewDidLoad method of your Collection View's controller (Swift example):
self.collectionView.itemPrototype = self.storyboard!.instantiateControllerWithIdentifier("collectionViewItem") as! NSCollectionViewItem
As of XCode 7.2, nd OSX 10.11 the issue is still there, the only way around this is by creating a nib based collection view cell and calling the method - (void)registerNib:(nullable NSNib *)nib forItemWithIdentifier:(NSString *)identifier on the collection view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With