Hello guys, i would like to create a WebView scree...
# compose-ios
b
Hello guys, i would like to create a WebView screen the KMM ios module, i notice the ios platform UIKIt implementation on KMM doesn't provide
WKNavigationDelegate
but
WKNavigationDelegateProtocol
v
Copy code
import platform.WebKit.WKNavigationDelegateProtocol
This one works for me just fine
Oh, I missed "but" in your question. Mb
p
I wrapped the delegate inside a factory class in swift exposed by @objc and used that instead,
v
So you basically with such swift wrappers can create "kotlin-friendly" APIs and obviously have access to any apple APIs?
p
yes - especially so for 3rd party APIs in pure swift.
that advice notwithstanding @brabo-hi, I’m pretty sure you can build a class that inherits WKNavigationDelegateProtocol and set the delegate to an instance of that.
Copy code
class NavigationHander (private val callBack: (String) -> Unit): WKNavigationDelegateProtocol, NSObject()
b
I think creating a wrapper class is a good way to go. Thanks for your support