4

I made tint colour black to better demonstrate this, but for SFSafariViewController is missing top bit on iphoneX. I checked twitter and theirs is present.

If I scroll down I can see website contents where the missing bit is

enter image description here

Ilja
  • 44,142
  • 92
  • 275
  • 498
  • Possible duplicate of [iPhone X status bar black web app](https://stackoverflow.com/questions/48876033/iphone-x-status-bar-black-web-app) – LGP Mar 22 '18 at 14:54
  • @LGP The question you've linked is about web apps, while this question is about `SFSafariViewController`. – Tamás Sengel Mar 22 '18 at 15:42
  • @Ilja were you able to fix this? – Bruno Lemos Apr 21 '18 at 07:44
  • @BrunoLemos It will keep happening if you hide statusbar in xcode, leave it enabled and hide it in your app's logic when this view is not active – Ilja Apr 21 '18 at 09:49

1 Answers1

3

I reproduced this bug when presenting SFSafariViewController while status bar was being hidden.

Solved it by configuring modalPresentationStyle to .overCurrentContext:

let safari = SFSafariViewController(url: url)
safari.modalPresentationStyle = .overCurrentContext
present(self, animated: true, completion: completion)

Hint: without configuring modalPresentationStyle, Safari presentation will have a push like transition.

tadija
  • 2,981
  • 26
  • 37
  • Nice solution, but it doesn't work with View controller-based status bar appearance = NO – Alexander Khitev Jun 18 '19 at 21:28
  • 1
    @AlexanderKhitev UIViewControllerBasedStatusBarAppearance is introduced in iOS 7 and defaults to YES. The older, UIApplication-based API is deprecated since iOS 9 and is unavailable when compiling extensions. Solution: migrate your code to use the new, non-deprecated logic. – tadija Jun 19 '19 at 15:44