Using a playground to display a view controller that has a uicollectionview. When I go to dequeue the cell, I get a SICABRT. Switched to simpler cell type and the issue still happens.
var collectionView:UICollectionView!
let flowLayout = UICollectionViewFlowLayout()
flowLayout.scrollDirection = UICollectionViewScrollDirection.Horizontal
self.collectionView = UICollectionView(frame: CGRect(x: 0.0, y: 0.0, width: self.frame.size.width, height: kDayViewHeight), collectionViewLayout: flowLayout)
self.collectionView.translatesAutoresizingMaskIntoConstraints = false
self.collectionView!.delegate = self
self.collectionView!.dataSource = self
self.collectionView.contentOffset = CGPoint(x: 0.0, y: 0.0)
self.collectionView.allowsSelection = true
self.collectionView.allowsMultipleSelection = false
self.collectionView.backgroundColor = UIColor.whiteColor()
self.collectionView.showsVerticalScrollIndicator = false
self.collectionView.showsHorizontalScrollIndicator = false
self.collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
self.addSubview(self.collectionView)
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as UICollectionViewCell
return cell
}
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'