title: How do I communicate from JS to Swift
body: <p>I'm creating a hybrid app and I'm trying to figure out how to pass some data from the WKWebView to the native app.</p>
  
  <p>I've been trying to figure this out for days and I can't seem to find anything! There seems to be very little info online about this, and everything I do find, is the other way around (Swift to JS, not JS to Swift).</p>
  
  <p>I've tried using URL variables, but the Webview has to reload for Swift to recognize that it changed. I tried using <a href="https://developer.apple.com/documentation/webkit/wkscriptmessagehandler" rel="noreferrer">WKScriptMessageHandler</a>, but I can't find any good documentation about it, and it seems very complicated. </p>
  
  <p>There must be some easy way to accomplish this.
  Any ideas?</p>
  
  <p>I would be really grateful to anyone who can help me with this.</p>