Swift - open web page in app, button doesn't react
missing url scheme
UIApplication.shared.open(URL(string: "http://www.google.com")!, options: [:], completionHandler: nil)
Swift 4, safely unwrapped optional, check if canOpenURL
if let url = URL(string: "https://www.google.com"),
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:])
}
Swift 3 Version
UIApplication.shared.openURL(NSURL(string: "http://google.com")! as URL)