I have a view controller A, which has a xib in the storyboard. Then I subclass B from A.
Right now I want to present a view controller of B.
If I do something like
self.presentViewaController(B.init(), animated: true)
It's actually working, but not loading the xib. The app will crash saying the collectionView is nil. Let's say the xib has a collectionView, and in class A:
class A: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
}
class B: A {
//Should be empty right? since it inherits from A,
// but the collectionView from super class is not initialized.
}
How do I fix this issue so that when I instantiate B, I can have the collectionView initialized?