Open alexandre-g opened 6 years ago
I don't entirely understand your setup.
What is the type of your R.reuseIdentifier.logosAddCell
?
Custom classes for CollectionView cells should be subclasses of UICollectionViewCell
.
I would expect logosAddCell
to be of type Rswift.ReuseIdentifier<UIKit.UICollectionViewCell>
or something more specific. That should work with the custom dequeueReusableCell
overload from the Rswift library.
So when I have the cell selected, it's of type UICollectionViewCell as expected (but maybe if you don't specify a custom subclass, Xcode treats it as UIView?)
The generated code is:
static let logosAddCell: Rswift.ReuseIdentifier<UIKit.UIView> = Rswift.ReuseIdentifier(identifier: "logosAddCell")
Actually, just looked in the storyboard and it's a collectionViewCell
:
`
I see, you're using a storyboard, I was testing this with a nib file.
It seems there's a bug in R.swift where it doesn't correctly generate the code for collection view cells in storyboards. It does work correctly for nibs.
Note to self: this table in Storyboard.swift should include all elements that can occur in a storyboard, but at least the once from Nib.swift
Hi, trying to replace:
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "logosAddCell", for: indexPath)
with
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: R.reuseIdentifier.logosAddCell, for: indexPath)!
But getting:
Cannot convert value of type 'ReuseIdentifier<UIView>' to expected argument type 'String'
Working for table view but not for collection views. Swift 4
Any ideas?
Edit: It seems to work when the cell has a custom class set.