toObjectOf(_:)
Converts the JavaScript value to a native object of the specified class.
Declaration
func toObjectOf(_ expectedClass: AnyClass!) -> Any!Parameters
- expectedClass:
The Objective-C or Swift class type to convert the value to.
Return Value
An Objective-C or Swift object representing the JavaScript value, or nil if the value cannot be converted to the expected class.
Discussion
Use this method to enforce a specific type conversion from JavaScript, or to retrieve Objective-C or Swift objects of custom classes that were bridged into JavaScript using the JSExport protocol.