You can use UICollectionViewDelegateFlowLayout
// Compute the dimension of a cell for an NxN layout with space S between
// cells. Take the collection view's width, subtract (N-1)*S points for
// the spaces between the cells, and then divide by N to find the final
// dimension for the cell's width and height.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,	
	 sizeForItemAtindexPath: IndexPath) -> CGSize {
		let cellsAcross: CGFloat = 1
let spaceBetweenCells: CGFloat = 1
let dim = (self.cvImageViewer.bounds.width - (cellsAcross - 1) * spaceBetweenCells) / cellsAcross
return CGSize(width: dim, height: self.cvImageViewer.bounds.height)
}
This solved the issue for me
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: