Dev:Cycript

Cycript is a Javascript interpreter which also understands Objective-C syntax. The cycript binary is also a REPL for this language.

Besides evaluating scripts, Cycript can also hook into a running process (using cycript -p process) and modify its property.

Official documentation can be found on cycript.org.

Presentations about Cycript: saurik explaining how to use Cycript on OS X, targeting the iOS simulator; Adam Bell explaining how to use Cycript to prototype a tweak (example code).

JS/ObjC Object Bridging
Some native Javascript types are bridged to the corresponding Objective-C types for convenient, so you can use instead of

null in Cycript is equivalent to nil in Objective-C. Additionally, nil, YES and NO are also defined in Cycript.

Javascript 1.6+ Features
Cycript supports the following Javascript 1.6+ features extended by Mozilla:
 * for each/in (JS1.6)
 * Array comprehensions (JS1.7)


 * E4X (not available on iPhoneOS).

REPL-only additions
These are used for debugging.

Additional types
Additionally, the identifiers like int</tt>, id</tt>, char</tt>, double</tt>, etc. are predefined to the corresponding types (new Type("i")</tt>, etc). Therefore, to allocator a pointer you may simply use new int</tt> or even new int[42]</tt>.

Other uses
The cycript binary can be used to "compile" Cycript into standard JavaScript 1.5 with the -c</tt> flag, e.g.