0
votes

In the storyboard, I embedded controller B into controller A. However when I try to access the outlets in controller B from controller B's viewDidLoad, viewWillAppear, or viewDidAppear methods, they're nil.

Why would an embedded controller's own outlets be nil after the view has loaded?

1
I tried the following steps: new project with single view template, create a second view controller subclass, add a container view to my first controller, set the class of the contained controller, add a button to the contained controller and make an outlet connection, print the value of the button in viewDidLoad of the second controller. Result: the connection is good. Maybe you can compare what you're doing to a working simple case. - Phillip Mills
@PhillipMills Not sure what I'm doing wrong. Sample project here if you're willing to look: github.com/AaronBratcher/Tester - Aaron Bratcher

1 Answers

0
votes

You are building your LiveView controls in a storyboard scene that's not being used. Move your various views and buttons into the scene that's connected to your container view by the embed segue.