ios - How can I access Collection View from delegate & datasource class? -


i have view controller contains collection view. collection view's delegate , datasource 1 custom class , can't access collection view class. class includes uicollectionviewflowlayout, uicollectionviewdelegateflowlayout, uicollectionviewdatasource.

i tried accessing collection view typing self.collectionview didn't work, saying: "fatal error: unexpectedly found nil while unwrapping optional value (lldb)".

tried setting static let variable points view controller containing collection view didn't work.

delegates , datasources dataprovider, not more. extracting them own classes idea (object oriented design). these classes shouldn't implement more api of protocol , maybe private helper functions them. each protocol function provide access collection view giving reference first parameter.

e.g.

func numberofsections(in: uicollectionview)  

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -