Search code examples
iosswiftsfsafariviewcontroller

SFSafariViewController as subview


I would like to use the SFSafariViewController but still add a few buttons of my own below. I havn't found a way to do this.

I tried using

let svc = SFSafariViewController(URL: testURL)
self.containerView.addSubview(svc.view)

This results in a blank white screen. Is there a way to accomplish this with SFSafariViewController or do I have to build my own "browser" with WKWebView?

Thanks in advance!


Solution

  • SFSafariViewController is not too customisable by definition (of Apple), it's suppose to give the user a close UX/UI experience of the regular Safari App.

    If you want to add your own buttons you'd be have to create your own subclass of UIViewController and add a WKWebView as a subview to it.