How to change collection view scroll direction?
1 min readDec 22, 2019
This is how you create it in code with UICollectionViewFlowLayout
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
let collectionView = UICollectionView(frame: frame, collectionViewLayout: layout)
This is how if you are working with an existent collection view
if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
layout.scrollDirection = .vertical
}
Thanks for reading :)