iOS 15.2: SwiftUI.PlatformViewHost incorrectly calculates safe area insets for itself and its view hierarchy
Please provide a descriptive title for your feedback:
iOS 15.2: SwiftUI.PlatformViewHost incorrectly calculates safe area insets for itself and its view hierarchy
Which area are you seeing an issue with?
SwiftUI Framework
What type of feedback are you reporting?
Incorrect/Unexpected Behavior
Please describe the issue and what steps we can take to reproduce it:
On iOS 15.2, SwiftUI.PlatformViewHost incorrectly calculates safe area insets for itself and its view hierarchy.
I have attached an example project which reproduces the issue. In the example project, I add a UIHostingController, which has additionalSafeAreaInsets set to non-zero value. Further down the hierarchy, I have a UIViewRepresentable, which gets wrapped in a PlatformViewHost. The result is that the view in UIViewRepresentable gets an incorrect safeAreaInsets value.
This is a regression in iOS 15.2.
See screenshots from iOS 15.0 and iOS 15.2, where the issue is clear.
See https://twitter.com/LeoNatan/status/1458388991666016257 This is an Apple bug, and FB9750551 has been opened: