I'm having trouble dequeuing more than one cell in my uicollectionview. Can someone explain the process step by step from registration to dequeuing. I can't find anything online pertaining to loading two or more uicollectionview cells in one collection view. Again this is for loading more than one type of cell in a single collectionview based of a variable from coreadata.
here's what I have so far.
Here's where I register the cells
collectionView?.register(ShareCell.self, forCellWithReuseIdentifier: cellId)
collectionView?.register(ShareCellMedia.self, forCellWithReuseIdentifier: mediaCellId)
Here's my cell for item at index path
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath :
IndexPath) -> UICollectionViewCell {
let friend = fetchedResultsController.object(at: indexPath) as! Friend
if (friend.lastMessage?.hasImage)! == true {
let mediaCell = collectionView.dequeueReusableCell(withReuseIdentifier: mediaCellId, for: indexPath) as!
ShareCellMedia
mediaCell.cell = friend.lastMessage
return mediaCell
}else{
let regularCell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as!
ShareCell
regularCell.cell = friend.lastMessage
return regularCell
}
}