I have an app that uses a SFSafariViewController. The user clicks on a button and a webview appears inside the app presenting the contents of the site. I'm using XCUITest framework to test the UI.
I notice that when the webview appears, the navigation bar and the bottom tool bar seem to always have the same UI elements.
Navigation Bar UI Elements (going from left to right):
Bottom Tool Bar UI Elements (going from left to right):
From a UI test standpoint, can I assume that these UI elements will always be present as default for a SFSafari VC?
You can see the full configuration available for SFSafariViewController here: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle. From what I can see, here's what can be configured out of the box:
Done
, Close
and Cancel
are the options): https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle You can make the top nav bar "collapsable" with the barCollapsingEnabled
property. https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/configuration/2887469-barcollapsingenabled
You can change the preferred tint colors of the bar
and the controls
(buttons).
Other than that, SFSafariViewController has few options available for customization.
So the answer to your question is: No, you can't assume these elements will always be present. However, in most scenarios they will be. In general, I wouldn't assume anything anyway, because Apple could always change it in future iOS versions.