I know how to pass strings (e.g. from DOM text nodes) from JavaScript (inside an apps WKWebView
) to Swift.
What other types are supported? For instance, could I pass DOM elements inside WKScriptMessage
?
I have never seen any proper documentation for this. I have successfully put stuff in there that is JSON
compatible.
I don't think a DOM element works. But just try it and see what you get back. You may have to turn it into a simpler object first in JavaScript.