Just wondering why I can't access the inherited object collectionView when lazy initializing:
class FunCollectionLayout : UICollectionViewFlowLayout {
var middleSection:Int = {
let sectionCount = self.collectionView!.numberOfSections()
return sectionCount/2
}()
func testFunc() {
print((self.collectionView?.numberOfSections())! / 2)
}
}
The error is:
Value of type 'NSObject -> () -> FunCollectionLayout' has no member 'collectionView'