Closed jonybur closed 7 years ago
@jonybur - have you looked at the swift version of the CustomCollectionView example project?
Oh golly, I didn't see that example before. I will check it out and work with it from now on. Thank you so much.
@jonybur - no worries! It was just merged last night, so it hasn't been around long. :)
I got the same crashed, after I removed the line: _collectionNode.registerSupplementaryNode(ofKind: UICollectionElementKindSectionHeader)
. I removed it because I don't want a title for the section(I just have one section without title). So how to fix it?
You shouldn't need to register supplementary nodes since they are not reused like in a standard UICollectionView. Just return the nodes in the appropriate datasource methods and you should be ok.
could you explain more detail, maybe some code will more clearer?
I'm trying to port the example project CustomCollectionView to Swift, leaving the layout class 'MosaicCollectionViewLayout' as it comes (using a bridging header).
First I initalize the ASCollectionNode as follows:
The ASCollectionNode lives inside an ASViewController class, that also inherits from ASCollectionDelegate and ASColllectionDataSource (trying to make it just like the objc project)
In init() I run this lines to initialize the variables.
Right after that declaration and filling the NSMutableArray "sections", I'm trying to run registerSupplementaryNode just like in the sample project, but I get a crash.
The line that breaks the project:
collectionNode.view.registerSupplementaryNode(ofKind: UICollectionElementKindSectionHeader);
The error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MosaicCollectionViewLayoutInspector collectionView:numberOfSectionsForSupplementaryNodeOfKind:]: unrecognized selector sent to instance 0x170015f80'
What am I missing? I know this might be a rather newbie question but I couldn't find any documentation to find a solution to my issue.
Thank you.