Skip to content

Commit

Permalink
fix for iOS 16 - force safeAreaInsets update (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-neuses authored Aug 16, 2023
1 parent 3320069 commit 28d3633
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ internal final class SnapshotWindow: UIWindow {
isHidden = false

if window != nil {
// In iOS 16 and 17, setting `isHidden` nor does not update
// the safeAreaInsets on the rootViewController's view. Updating
// `additionalSafeAreaInsets` will so force an update
if scenarioViewController.view.safeAreaInsets == .zero {
scenarioViewController.additionalSafeAreaInsets = .init(top: 1, left: 0, bottom: 0, right: 0)
scenarioViewController.additionalSafeAreaInsets = .zero
}

// Prioritise use snapshot device's `safeAreaInsets`
// by `additionalSafeAreaInsets` if having a parent window.
let originalSafeAreaInsets = scenarioViewController.view.safeAreaInsets
Expand Down

0 comments on commit 28d3633

Please sign in to comment.