The string is needed by Swift String Interpolation , plus additional quotation marks, for example:
func sendSomething(stringToSend : String) { appController?.evaluateInJavaScriptContext({ (context) -> Void in context.evaluateScript("myJSFunction('\(stringToSend)')") }, completion: { (evaluated) -> Void in print("we have completed: \(evaluated)") }) }
source share