Native ability to swap the embedded view controller in a container view controller.

Number:rdar://36349742 Date Originated:1/8/18
Status:Open Resolved:
Product:UIKit Product Version:
Classification:Suggestion Reproducible:

I really like using Container Views in storyboards. It it extremely nice to setup my UI architecture with separate concerns in separate view controllers. It creates much cleaner MVC when I can break down tasks / items into completely separate view controllers and use delegates to communicate to each other. Unfortunately sometimes you need the embedded view to change based on interactions from the user. To solve this problem we have build a custom embed switcher. Attached is an iOS sample project of the behavior we build into our apps.

A live example of an app where we use this extensively:
Loading an image / video, loading different editing tools, etc. is heavily using this.

In the absolute idea scenario UIContainerViewController would become a full UIKit accessible controller instead of having to write your own. And the embed property would be read/write and you could change which controller was currently embedded.

Alternative great improvements instead would be able to define multiple embeds and then the ability to swap between them in a container view. I'm not 100% sure how that would work built in, but maybe a new segue type built in that is an EmbedSegue or something.

The basic feature suggestion is to be able to natively swap which view is embedded in a container view controller without having to write a custom one.

All of this also applies to AppKit on MacOS as well. The feature would be just as helpful there as well.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!