UIHostingController should set preferredContentSize
Originator: | kyledsherman | ||
Number: | rdar://FB7650894 | Date Originated: | 04/03/2020 |
Status: | Open | Resolved: | Open |
Product: | SwiftUI | Product Version: | 11.3.1 |
Classification: | Bug | Reproducible: | Always |
When using a UIHostingController with a SwiftUI view, it will size itself based on the size of the SwiftUI view. However, it doesn't set the `preferredContentSize` property to that value. This makes it not useful when you try to use that hosting controller as content in a popover. Currently, the workaround I'm using is making a subclass of UIHostingController that just does the following in the viewDidLayoutSubviews method: `preferredContentSize = view.subviews.first?.frame.size ?? .zero`.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!