Created
May 17, 2018 20:17
-
-
Save harrysummers/6bc5d52897feca8afd24271c5346051d to your computer and use it in GitHub Desktop.
UICollectionView programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy var collectionView: UICollectionView = { | |
let layout = UICollectionViewFlowLayout() | |
layout.itemSize = CGSize(width: 140, height: 250) | |
layout.scrollDirection = .horizontal | |
let collection = UICollectionView(frame: self.view.frame, collectionViewLayout: layout) | |
collection.translatesAutoresizingMaskIntoConstraints = false | |
collection.register(GifCollectionViewCell.self, forCellWithReuseIdentifier: cellId) | |
collection.backgroundColor = UIColor.CustomColors.spotifyDark | |
collection.bounces = true | |
collection.alwaysBounceHorizontal = true | |
collection.alwaysBounceVertical = false | |
collection.delegate = self | |
collection.dataSource = self | |
return collection | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment