Loading views into NSContainerView with swift

Solutions Collect From Internet About “Loading views into NSContainerView with swift”

“Container View defines a region within a view controller’s view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard.”

You mentioned NSContainerView, so I assume you’re trying to do this on macOS, not iOS. Here’s a useful article and code project (for iOS 6, but I was able to set up switchable subviews in iOS 9 using this as a guide):

The important bits are using the embed segue, then wiring the view controllers together through a combination of viewDidLoad and prepareForSegue, and then finally loading one of the switchable view controllers (say one for each of your buttons) from the storyboard, where they are not connected to anything else.