Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import SafariServices
- class MainViewController: UIViewController {
- @IBOutlet weak var urlTextField: UITextField!
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- }
- @IBAction func startBrowser(_ sender: Any) {
- if let url = self.urlTextField.text {
- let sfViewController = SFSafariViewController(url: NSURL(string: url)! as URL)
- self.present(sfViewController, animated: true, completion: nil)
- }
- print ("Now browsing in SFSafariViewController")
- }
- }
Add Comment
Please, Sign In to add comment