New to iOS development.
ContentView.swift:
struct ContentView: View {
var body: some View {
WebView(url: "https://www.stackoverflow.com")
}
}
WebView.swift:
struct WebView: UIViewRepresentable {
var url: String
func makeUIView(context: Context) -> WKWebView {
guard let url = URL(string: self.url) else {
return WKWebView();
}
let request = URLRequest(url: url)
let wkWebView = WKWebView()
wkWebView.load(request)
wkWebView.allowsBackForwardNavigationGestures = true
return wkWebView
}
func updateUIView(_ uiView: WKWebView, context: UIViewRepresentableContext<WebView>) {
}
}
results in a white bar behind the home button indicator:
How can I make the webview fullscreen so that there is no more white bar behind the home button?
You need to set bottom space of Your WebView not to Safe Area but to Superview Select View here
for SwiftUI version just do
struct ContentView: View {
var body: some View {
WebView(url: "https://www.stackoverflow.com")
.edgesIgnoringSafeArea([.bottom])
}
}