How to configure SFSafariViewController as a Details Controller for a UISplitViewController?

As you can see from the documentation and all the examples, I found that the SFSafariViewController needs to be programmatically created with a specific URL as the setting parameter. Can I use SFSafariViewController as a drillthrough controller for a UISplitViewController? The only way I can do this is to configure segue in the storyboard, but in this case the SFSafariViewController will not have the URL needed to display its contents. Any advice on how to do this, programmatically, if possible, would be appreciated.

+5
source share
1 answer

It is possible! I searched for a long time and found a solution. I do this in my main view controller, the Table View Controller. If I select a cell in my table view, the SafariViewController opens in the detail view.

let safariViewController = SFSafariViewController(URL: NSURL(String: "http://google.com")) self.showDetailViewController(safariViewController, sender: nil) 

Result: Safari View Manager Information

This is due to some problems.

  • You must use iOS 9.1 or more to avoid this user interface error : UI Error Safari View Controller

  • You should hide the navigation bar if you want to see the standard Safari view controller panel (with URL, ...)

+5
source

Source: https://habr.com/ru/post/1246433/


All Articles