You are setting the web view's navigationDelegate property from within one of the delegate's own methods. The delegate can't call that function because it hasn't been assigned to and doesn't know your implementation exists.
Assign your delegates when you create the view, like in the makeUIView(context:) method.
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.uiDelegate = context.coordinator
webView.navigationDelegate = context.coordinator
return webView
}
Now the delegate knows the functions to call and you should see your print statement appear in the console.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: