title: Communicate between Javascript and WebView native code in Xamarin.Forms iOS
body: <p>OK so this works on Android... I'm stuck on iOS.</p>
  
  <p>I have a custom HTML WebView which has a JavaScript event:</p>
  
  <pre><code>const string html= @"&lt;button type=""button"" onClick=CSharp.SendButton(' + buttonCode + ')""&gt;Click here&lt;/button&gt;";
  </code></pre>
  
  <p>On Android, I have a webview custom renderer:</p>
  
  <pre><code>protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
  {
      if (Control != null)
      {
          Control.Settings.JavaScriptEnabled = true;
          Control.AddJavascriptInterface(new JSBridge(Forms.Context), "CSharp");
      }
      base.OnElementPropertyChanged(sender, e);
  }
  </code></pre>
  
  <p>And JSBridge is a bridge between Javascript and C#:</p>
  
  <pre><code>public class JSBridge : Java.Lang.Object
  {
      Context context;
  
      public JSBridge(Context context)
      {
          this.context = context;
      }
  
      [Export]
      [JavascriptInterface]
      public void SendButton(string code)
      {
          // I can pass the buttonCode here
      }
  }
  </code></pre>
  
  <p>How can I do something similar on iOS?</p>
  
  <p>Please note: I am aware of the HybridWebView examples on the Microsoft website: I dont want to use a seperate Javascript file, I want to fire the event from my HTML and catch it in my renderer.</p>