LeoNatan / LNPopupUI

A SwiftUI library for presenting views as popups, much like the Apple Music and Podcasts apps.
MIT License
320 stars 29 forks source link

iOS 15.2 has broken safe area insets under some conditions #12

Closed LeoNatan closed 2 years ago

LeoNatan commented 2 years ago

See https://twitter.com/LeoNatan/status/1458388991666016257 This is an Apple bug, and FB9750551 has been opened:

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.

LeoNatan commented 2 years ago

Fixed by Apple in iOS 15.2 beta 3.