Swift3 URLをSafariで開く


// URLをSafariで開く
func openWithSafari(url: URL?) {
    guard let openUrl = url else {
        print("無効なURLです")
        return
    }
    
    if UIApplication.shared.canOpenURL(openUrl as URL) {
        print(openUrl)
        UIApplication.shared.open(openUrl)
    }
}