Collection-View-in-a-Table-View-Cell
Collection-View-in-a-Table-View-Cell copied to clipboard
Could not cast value of type 'UIViewController' to 'UICollectionViewDataSource'
The error appears whenever i want to open a view which is inside container view
Which line of code?
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { guard let tableViewCell = cell as? TimeLineTableViewCustomCell else {return}
let castSelf = self as! protocol <UICollectionViewDataSource, UICollectionViewDelegate>//THIS LINE
tableViewCell.setTagsCollectionViewDataSourceDelegate(castSelf, forSection: indexPath.section)
tableViewCell.tagsCollectionViewOffset = tagsStoredOffsets[indexPath.row] ?? 0
}
What version of Xcode/Swift are you using? I haven't updated this tutorial for Swift 3 yet. I'll open an issue.
I am using Swift 2 and xcode version is 7. Just for your information. This code works without any error for the different view. But it gives error now. I thinks there is problem in my viewcontroller maybe
Same thing here. I'm trying to create this example by just code (not using the IB), And I'm getting stuck when trying to use de Delegate and DataSource function.
This is the function inside the Custom Cell Class:
I'm missing something?
Cheers!
Sorry, I haven't had time to update this to Swift 3 yet. It looks like the ReviewViewController doesn't conform to the delegate/datasource protocols. Can you double-check that?