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.

Considerations

 * Every command typed into the console is run in an autorelease pool so variables "declared" in one command might be deallocated byt the time the next command that uses it is run.