UAFilterableResultsController
UAFilterableResultsController copied to clipboard
Suggestions for using collectionViewLayout:sizeForItemAtIndexPath:
At the moment, I'm using a static size cell, however, it'd be nice to actually size the cells to fit their content.
UAFilterableResultsController provides filteredObjectAtIndexPath to get items by their indexPath and it works in the other delegate calls, but not in this case.
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let viewModel = self.searchResultsController.filteredObjectAtIndexPath(indexPath) as! Object
let titleWidth = //...
return CGSizeMake(titleWidth, 44)
}
It'll work on the initial go, but as soon as you attempt to filter the results, you'll get a crash. I know that's vague, but I haven't looked too deep into it yet.