Mi pregunta es sobre swift, SFSafariViewController: Quiero crear una app que al abrirse cargue directamente una web, uso xcode 11.6 pero me da error el archivo sceneDelegate. Si lo suprimo el proyecto no da error pero no se carga ninguna web, este es el error:
generic class UIHostingController requires that vistaSafari conform to view sceneDelegate.
Código:
import UIKIt
import SafariServices
class vistaSafari: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: bool){
cargarWeb()
}
func cargarWeb() {
if let url = URL(string: "https://google.com") {
let safariVC = SFSafariViewController(url: url)
present(safariVC, animated: true, completion: nil)
}
}
}
También he probado:
import UIKIT
import SafariServices
class vistaSafari: UIViewController, SFSafariViewDelegate {
override func viewWillAppear(_ animated: bool) {
let safariVC =SFSafariViewController(url: URL(string: "https://www.google.com")!)
safariVC.delegate = self
present(safariVC, animated: true) } }