I want to push to a full screen SFSafariViewController from half model sheet.
What I want is first present a sheet with a "Link Btn" , the click "Link Btn" to push to a full screen webview to show a web page, just like bellow:
My code is a bellow:
import SwiftUI
import SafariServices
struct ContentView: View {
@State private var showingVC = false
var body: some View {
NavigationView() {
VStack() {
Button(action: {
self.showingVC = true
}, label: {
Text("Show sheet")
})
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.background(Color.gray.opacity(0.2))
.sheet(isPresented: $showingVC) {
PresentView()
}
}
}
}
struct PresentView: View {
var body: some View {
NavigationView() {
VStack() {
NavigationLink(destination: SafariView(url: URL(string: "https://github.com/")!)) {
Text("Link btn")
.foregroundColor(.blue)
}
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.background(Color.gray.opacity(0.2))
}
}
}
struct SafariView: UIViewControllerRepresentable {
let url: URL
func makeUIViewController(context: UIViewControllerRepresentableContext<SafariView>) -> SFSafariViewController {
return SFSafariViewController(url: url)
}
func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext<SafariView>) {
}
}
But the final web page is not full screen and have two navigation bars as bellow:
How can I push to a full screen webview with only one navigation bar from a presented sheet view?