override func viewDidLoad() {
super.viewDidLoad()
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
let width = UIScreen.main.bounds.width
layout.sectionInset = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
layout.itemSize = CGSize(width: width / 2 - 20, height: width / 2)
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
popularServicesCollectionView!.collectionViewLayout = layout
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter