Due to the default WKWebView behavior, the "Share" function in iOS might not work properly.
In Order to fix it, follow up the following steps:
Add WKUserContentController to WKWebView configuration:
webView.configuration.userContentController.add(self, name: "openLink")
Implement WKScriptMessageHandler delegate method for ViewController
func userContentController(_ userContentController: WKUserContentController,
didReceive message: WKScriptMessage) {
if message.name == "openLink", let urlString = message.body as? String,let url = URL(string: urlString) {
UIApplication.shared.open(url)
}
}