June 29, 2017

Swift class to implement variables at JavaScriptCore

Here is a table to know which class is used to implement variable on JavaScriptCore.


  1. The boolean value will be kept as NSNumber<Int> when it is a member of array and dictionary.
Object in JavaScript Type hierarchy to present by Swift
true JSValue.Bool
123 JSValue.NSNumber<Double>
1.23 JSValue.NSNumber<Double>
["hello", "world"] JSValue.Array.String
[true, false] JSValue.Array.NSNumber<Int>
[a:12] JSValue.Dictionary[String: NSNumber<Double>]
[a:true] JSValue.Dictionary[String: NSNumber<Int>]

No comments: