Search code examples
iosiphoneiphone-xsfsafariviewcontroller

SFSafariViewController missing top bit on iphoneX


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


Solution

  • 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.