This is driving me crazy! I have a UICollectionViewController as shown below:
class PhrasesCompactCollectionViewController: UICollectionViewController
You need to specify that you implement the protocol UICollectionViewDelegateFlowLayout in your class declaration.
UICollectionViewDelegateFlowLayout
class PhrasesCompactCollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout