Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//Asks the delegate for the size of the specified item’s cell.
//If you do not implement this method, the flow layout uses the values in its itemSize property to set the size of items instead. Your implementation of this method can return a fixed set of sizes or dynamically adjust the sizes based on the cell’s content.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
{
let width = locations[indexPath.row].name.width(withConstrainedHeight: 50, font: LocationCell.locationNameFont);
return CGSize(width: width + 10, height: 50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment