Trying to make an app launch the default browser to a URL, but only if the URL entered is valid, otherwise it displays a message saying the URL is invalid.
How would
For Swift 4 version
static func isValidUrl (urlString: String?) -> Bool { if let urlString = urlString { if let url = URL(string: urlString) { return UIApplication.shared.canOpenURL(url) } } return false }