Protocols
The following protocols are available globally.
-
A JavaScript expression that can be evaluated inside of a web view (
WKWebView
).The library provides ready-to-use expression implementations:
JSVariable
to access a variableJSFunction
to call a functionJSScript
to run a custom script
You don’t need to implement this protocol yourself.
Expressions are specialized with the
ReturnType
associated type. Expressions can return anyDecodable
type. This includes:JSVoid
for expressions that do not return a value- Primitive values (Strings, Numbers, Booleans, …)
- Decodable enumerations
- Objects decodable from JSON
- Arrays of primitive values
- Arrays of enumeration cases
- Arrays of objects
- Native dictionaries
Declaration
Swift
public protocol JSExpression