Answers for "swift open url in browser"

2

swift open url

guard let url = URL(string: "http://www.google.com") else {
  return //be safe
}

if #available(iOS 10.0, *) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
    UIApplication.shared.openURL(url)
}
Posted by: Guest on March-06-2020
1

swift open settings page

guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
  return
}

if UIApplication.shared.canOpenURL(settingsUrl) {
  UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
                                                             print("Settings opened: \(success)") // Prints true
                                                            })
}
Posted by: Guest on March-04-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language