To display web contents in the app, it sounds like SFSafariViewController is useful, but I have never used it. So today, I'll write some example codes.
Add 3 methods to view controller.
@IBAction func push(sender: AnyObject) {
navigationController?.pushViewController(createSafariController(), animated: true)
}
@IBAction func present(sender: AnyObject) {
let safariController = createSafariController()
safariController.delegate = self
presentViewController(safariController, animated: true, completion: nil)
}
@IBAction func showWithRightButtonItem(sender: AnyObject) {
let safariController = createSafariController()
let barButtonItem = UIBarButtonItem(barButtonSystemItem: .Action, target: self, action: "barButtonItemDidTap:")
safariController.navigationItem.rightBarButtonItem = barButtonItem
navigationController?.pushViewController(safariController, animated: true)
}
Then run project...It's nice!
That's all. Sure enough, safari view controller is very convenient. I'll use this in the next app.