I’m assuming toView here is the view in DetailViewController…
Why do we have to add toView to the container view, isn’t it already there? Since Container View is on top of the presenting View controller(SearchViewController in this case) and contains the views in presented view controller(DetailViewController)
Try it. Remove that addSubview() line and see what happens.
toView is where you are going. So no, the view isnt there. You have to add that new view into the container view.