SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.32k stars 746 forks source link

Add option to preserve status bar space #488

Open juanj opened 2 years ago

juanj commented 2 years ago

Since iOS 13 it is no longer possible to show a view over the status bar. The workaround for this is to hide the status bar before showing the view (see https://github.com/SwiftKickMobile/SwiftMessages/issues/335).

The issue with this, is that when hiding the status bar on a device without a notch, the window safe area is updated to reflect this, and the content of the app is moved up.

This PR aims to solve this by adding a new option, Config.preserveStatusBarSpace, that when set to true takes the previous window safeAreaInsets and applies it to the root view controller before showing the new window, and sets it back when removing the window.

I decide to set it to false by default to preserve the existing behavior. Let me know if you see any big implications of adding this change that I may have overlooked.