I am having a problem using the evaluateJavaScript function in WkWebView.
I would like to use evaluateJavaScript to call a javaScript function:
let javascript = “funcName(“<json string>”)”
webView?.evaluateJavaScript(javascript, completionHandler: nil)
I obviously cannot do that because of the two levels of quotes on the javascript variable. I cannot escape the quotes around <json string> because when this finally calls the javascript function, the parameter must be a string.
In summary, how can you use evaluateJavaScript when the javaScript must contain quotes (that cannot be escaped)?