Marie Arkan
Marie Arkan

Reputation: 55

How to fix this 'Prototype Segue' related with my NSCollectionView (Xcode 7.0 beta)

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 --'

Upvotes: 4

Views: 2038

Answers (2)

dubemike
dubemike

Reputation: 2222

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.

Upvotes: 2

EugZol
EugZol

Reputation: 6545

It seems you have to specify connection manually.

  1. Add "collectionViewItem" Storyboard ID to your collection view item.

screenshot

  1. Add the following code to viewDidLoad method of your Collection View's controller (Swift example):

    self.collectionView.itemPrototype = self.storyboard!.instantiateControllerWithIdentifier("collectionViewItem") as! NSCollectionViewItem
    

Upvotes: 5

Related Questions