Open WebView links in Safari View Controller. (Xcode, Swift)

I am trying to open various WebView links in a Safari View Controller.

So from within a WebView (Swift) I need to be able to open all external links in Safari View Controller, with the exception of internal links that will open within the WebView (self).

Answers


//MARK: Button Click on open with SafariViewController

private var urlString:String = "https://google.com"

@IBAction func openWithSafariVC(sender: AnyObject)
{
    let svc = SFSafariViewController(URL: NSURL(string: self.urlString)!)
    svc.delegate = self
    self.presentViewController(svc, animated: true, completion: nil)
}
//MARK: SafatriViewConroller Dismiss 

func safariViewControllerDidFinish(controller: SFSafariViewController)
{
    controller.dismissViewControllerAnimated(true, completion: nil)
}

Need Your Help