Open Link in Safari Swift 5.
This example to open particular link form your app to safari. That's redirect to app to safari browser.
Swift 5
Thanks.
Swift 5
guard let url = URL(string: "https://iosdevcenters.blogspot.com/") else {
return
}
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
Swift 2.0let url : NSURL = NSURL(string: "https://iosdevcenters.blogspot.com/")!
if UIApplication.sharedApplication().canOpenURL(url) {
UIApplication.sharedApplication().openURL(url)
}
Objective CNSURL *url = [NSURL URLWithString:@"https://iosdevcenters.blogspot.com/"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
Output:Thanks.
Open Link in Safari Swift 5.
Reviewed by KIRIT MODI
on
21:52:00
Rating:

No comments: