My code:
if let url = NSURL(string: \"www.google.com\") {
let safariViewController = SFSafariViewController(URL: url)
safariViewController.view.tintColor
I did a combination of Yuvrajsinh's & hoseokchoi's answers.
func openLinkInSafari(withURLString link: String) {
guard var url = NSURL(string: link) else {
print("INVALID URL")
return
}
/// Test for valid scheme & append "http" if needed
if !(["http", "https"].contains(url.scheme.lowercaseString)) {
let appendedLink = "http://".stringByAppendingString(link)
url = NSURL(string: appendedLink)!
}
let safariViewController = SFSafariViewController(URL: url)
presentViewController(safariViewController, animated: true, completion: nil)
}