Easy enough. Evaluate the script using
JSContext like this:
Calling the Function
1 2 3 4
Thats all it takes! So what’s going on here? First, we grab the
input for the method as a
JSValue. Finally, we
Call the function with our
input and we log the result.
You can create any type of parameter, even custom class objects using the overrides of
JSValue.From(). This is pretty powerful if you want to add some scripting capabilites to your app, all built into the Frameworks; cool!
The updated project to include this code is here.
There is an awesome blog post here, which is where I have been learning about this framework. The code is obj-c, but it is still really useful! Also, thanks to Sebastien Pouliot from Xamarin for helping me learn how to call these functions in Xamarin.iOS. You can find his blog here.