I want to create CollectionView using .xib file where i will add UICollectionViewCell using .xib too. Can we achieve it? If possible, please mention how do we get it.
Unlike storyboards, .xib files don't support prototype cells. So any collection view you create using a .xib, you must also create a UINib
and register it with the collection view before attempting to dequeue anything:
let nib = UINib(nibName: "Cell", bundle: nil)
collectionView.register(nib, forCellWithReuseIdentifier: "Cell")