im trying to execute Javascript in my Xamarin.Forms WebView by using the tutorial described here:
https://www.xamarinhelp.com/xamarin-forms-webview-executing-javascript/
Android works really good but I have problems setting this up on iOS. In the iOS custom renderer I basically return the js execute result by
return Task.FromResult(this.EvaluateJavascript(js));
Since last year the iOS api changed and this line throws an error when debugging. It turns out that I should use WkWebViewRenderer instead of WebViewRenderer. I tried to change but EvaluateJavascript() method now wants two arguments... one is the js string and one is a WKJavascriptEvaluationResult handler ...
I dont know how to adapt the code in the tutorial... can someone help?
I just changed
return Task.FromResult(this.EvaluateJavascript(js));
to:
var x = await webView.EvaluateJavascriptAsync(js);
return x;
and now it works