Search code examples
iosswiftsfsafariviewcontroller

Hide controls in sfsafariviewcontroller


let sfViewController  = SFSafariViewController(url: url)
sfViewController.delegate = self

self.ViewC!.present(sfViewController, animated: false, completion: nil)

I am opening a SFSafariViewController in my app. But for the security issue I do not want the controls given by this view. This view is giving Actions like- Done, Refresh, Share, Open in Safari.

For My purpose I just want Action- Done. Rest other actions should not be visible to user. I am supporting ios 10.0 + . Atleast that toolbar should not be there. Is it possible to do this?


Solution

  • No, You Can't customize SFSafariViewController .

    Apple says:

    Important

    In accordance with App Store Review Guidelines, this view controller must be used to visibly present information to users; the controller may not be hidden or obscured by other views or layers. Additionally, an app may not use SFSafariViewController to track users without their knowledge and consent.

    Lastly, indeed, you may use WKWebView instead for further customisation of your screen.

    If your app lets users view websites from anywhere on the Internet, use the SFSafariViewController class. If your app customizes, interacts with, or controls the display of web content, use the WKWebView class.

    Read doc: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller