I don't have a problem displaying each container view when switching between them using the segmented controller. What I do have a problem with is that whenever the parent view loads, both the blue and green container views also load.
I want the blue to load with the parent view controller and the green to load only when I switch the segmented control. Any Ideas?
- By loading I mean that viewDidLoad, ViewDidAppear, ViewDidlayoutSubviews, etc.. gets called
override fund viewDidload() {
super.viewdidload()
let child = GreenViewController()
addChild(child)
child.view.frame = frame
view.addSubview(child.view)
child.didMove(toParent: self)
}
I tried using the code above, but it doesn't seem to make a difference as loading for both child view controllers still load once the parent loads