UICollectionView is an object that manages an ordered collection of data items and presents them using customizable layouts. (UICollectionview documentation)

UICollectionView is a powerfull user interface building tool. User interface often requires to show UICollectionViewCells wit content-based height.

As you can see, there are different solutions. After some research on the topic I stopped on the solution below, which looks stable and safe.

## Case study

Create an applications to display Samuel L. Jacksons quotes. (We’ll take if from https://slipsum.com). Each quote should be displayed in separate UICollectionViewCell. Cell should be properly sized to fit the quote. UICollectionViewCell and contained IULabel should have bounding borders.

Another words, we will solve dynamic UICollectionViewCell height problem for fixed width cell.

## Solution

Create new XCode project (Use Swift language). Replace your AppDelegate.swift code with the following:

## The result

Works both screen orientations: