Don’t want to use a WebView? Open a web page in the app directly using Safari, and it’s super easy in two steps.
No nonsense. Just get to it. Simple
The first step is to introduce the Safari service
import SafariServices
Copy the code
The second step is to implement the trigger event in the ViewController
func showSafariVC(for url: String){
guard let url = URL(string: url) else {
return
}
let safariVC = SFSafariViewController(url: url)
self.present(safariVC, animated: true, completion: nil)
}
Copy the code
It’s that simple!!