Load Safari as a fullScreenCover inside of your application.
import SwiftUI
import SafariServices
struct SFSafariViewWrapper: UIViewControllerRepresentable {
let url: URL
func makeUIViewController(context: UIViewControllerRepresentableContext<Self>) -> SFSafariViewController {
return SFSafariViewController(url: url)
}
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SFSafariViewWrapper>) {
return
}
}
@State private var showSafari: Bool = false
Text("Open Design+Code in Safari")
.padding()
.onTapGesture {
showSafari.toggle()
}
.fullScreenCover(isPresented: $showSafari, content: {
SFSafariViewWrapper(url: URL(string: "https://www.designcode.io")!)
})