Hi there! I am developing an app that opens our website in a web view. The issue is that the web view will not open external links (e.x. if the main URL is https://example.com, the app will not open a link to https://example.org ). I have no idea what I am doing and was hoping a smart person here could help me out. Thanks!
import SwiftUI
import WebKit
extension WKWebView {
func load(_ urlString: String) {
if let url = URL(string: urlString) {
let request = URLRequest(url: url)
load(request)
}
}
}
struct WebView : UIViewRepresentable {
var url: String
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
print(url)
uiView.load(url)
}
}
struct ContentView: View {
var body: some View {
WebView(url: "https://warehousechurch.life")
}
}