I am getting this error, trying to use a UICollectionView in Swift:
NSInternalInconsistencyException', reason: 'attempt to register a cell class which is not a subclass of UICollectionViewCell ((null))
But I think I am registering the cell:
ViewDidLoad:
override func viewDidLoad() { super.viewDidLoad() self.collectionView.registerClass(NSClassFromString("CollectionCell"),forCellWithReuseIdentifier:"CELL") }cellForItemAtIndexPath:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath:NSIndexPath)->UICollectionViewCell { var cell = collectionView.dequeueReusableCellWithReuseIdentifier("CELL", forIndexPath: indexPath) as CollectionCell cell.titleLabel.text="cellText" return cell }
and the cell class:
class CollectionCell: UICollectionViewCell
{
@IBOutlet var titleLabel : UILabel
init(coder aDecoder: NSCoder!)
{
super.init(coder: aDecoder)
}
}
Any help appreciated