I have a view controller which contains collection view. Collection view's delegate and datasource are one custom class and I can't access Collection View itself from that class. The class includes UICollectionViewFlowLayout, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource.
I tried accessing the collection view by typing self.collectionView which didn't work, saying: "fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)".
Tried setting a static let variable which points to View Controller containing collection view but it also didn't work.
collectionViewvar you mentioned? This var should be marked as a@IBOutlet.