Reputation: 5567
I have a UIViewController in storyboard which hosts a collectionView which is referenced using a IBOutlet
. However, now I am placing this inside of a PageViewController
and referencing it like this, rather than with the use of a seque :
let initial = FeedCollectionViewController()
let viewControllers = [initial]
setViewControllers(viewControllers, direction: .Forward, animated: true, completion: nil)
The problem is that the collectionView
is now nil
.
Upvotes: 0
Views: 180
Reputation: 6379
Of course it's nil. You built your view controller in storyboard, so you should init it from storyboard. Like this:
let tabSb = UIStoryboard(name: "Main", bundle: nil)
let tabbarVc = tabSb.instantiateInitialViewController()
Upvotes: 1