Correct way of inserting Audio Unit views into Auto Layout

Hi, I'm struggling getting Auto Layout to play nice with views returned by AUv3 Audio Units. All I'm trying to do is to insert them into an existing view hierarchy in such a way that they get displayed in a nice way.

The sample code here on gitHub loads an Audio Unit, adds its view to a container view, deactivates translatesAutoresizingMaskIntoConstraints, pins the AU's view to the container, and adds a size constraint. That size constraint then gets updated in viewWillLayout to match the requested size of the Audio Unit view. This works perfectly fine for AUv2 Audio Units, but when I load an AUv3 Audio Unit (in particular the one created by Apple's sample code), it typically collapses to something tiny. Furthermore, its controller returns very small values for its preferredContentSize, so that's not usable either.

I've tried dozens of variations on this theme, but none of them seems to work. I am aware that I could simply fix the view size after checking for a few options with supportedViewConfigurations, but that feels like shooting in the dark and it still won't give me reasonable bounds between which to allow the view to resize... Did anyone here manage to solve this problem or could anyone at Apple weigh in on the preferred way to achieve this?
I would definitely suggest filing a report via Feedback Assistant if you think you’ve encountered some unexpected behaviour. A description of what you’re trying to do, how you expect it to work, and some screenshots / sample code attached would be super helpful. Post the FB number here and we can take a look!
I don't really understand what you're trying to do in doLoad:controller:.

It looks like your MyViewController instance was created as an object in MainMenu.xib, so it's not going to be in a window, and doesn't have well-defined geometry. Setting its root view width and height probably has no effect.

Or am I completely missing something?
@QuinceyMorris I first add the Audio Unit view to the container view and then fix the size of the latter so that it matches the Audio Unit. This gets updated in viewWillLayout which, at least in the case of AUv2 Audio Units, gets called when the user changes the intrinsic size of the view (for example by toggling "Details" in the case of AUMultibandCompressor).

Note that the root view of MyViewController is set to an NSView in MainMenu.xib, so changing the size of its view does have the effect of changing the size of the main window (again, see the AUMultibandCompressor example).

If I don't add the width and height constraints then the window does not adjust its height when the user toggles "Details" in AUMultibandCompressor (and it doesn't work any better for Apple's AUv3 sample).
@Apple See FB7783769 for a copy of the sample project as well as screenshots and a more detailed explanation.
Correct way of inserting Audio Unit views into Auto Layout
 
 
Q