Instance Method

evaluateJavaScript(_:completionHandler:)

Evaluates a JavaScript string.

Declaration

func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil)

Parameters

javaScriptString

The JavaScript string to evaluate.

completionHandler

A block to invoke when script evaluation completes or fails.

Discussion

The method sends the result of the script evaluation (or an error) to the completion handler. The completion handler always runs on the main thread.