I have a IBOutlet declared and connected to InterfaceBuilder in my CubeController class like so:
// Class CubeController
@IBOutlet weak var collectionView: UICollectionView!
Whenever I try to reference collectionView from another class, the collectionView is always an empty optional. This is my code:
// Another class
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath)
{
collectionView.performBatchUpdates
({
print("selekt")
let mug = CubeController()
let colView = mug.collectionView
if let _ = colView
{
print("uhu")
}
}, completion: {_ in
})
}
The "selekt" is printed, but "uhu" isn't. What's going on here? and What mistake did i do here?.The CubeController's collectionView outlet is working and displaying it self in user interface.How can i identify the mistake?