Created
October 11, 2019 05:24
-
-
Save strzempa/694cdd62e767a164d0a8497fd0320c07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension UIApplication { | |
class func tryURL(_ urls: [String]) { | |
let application = UIApplication.shared | |
urls.forEach { urlString in | |
guard let url = URL(string: urlString) else { | |
Logger.error?.message("Cannot make url from: \(urlString)") | |
return | |
} | |
if application.canOpenURL(url) { | |
application.open(url) | |
return | |
} else { | |
Logger.error?.message("Cannot open url: \(url)") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment