Skip to content
Via gcc and xcode, compile simple objective-c code provided as an NSString at runtime, and execute it within the context of the same, running, program.
Objective-C C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
English.lproj
objc-eval.xcodeproj
template_bundle
.gitignore
Info.plist
OEEvaluation.h
OEEvaluation.m
README.mdown
objc-eval_Prefix.pch

README.mdown

objc-eval

objc-eval is ruby-like eval ("eval? what's that?!" read this) for objective-c. Is it a good idea? I don't know. If you have to ask, it's probably not. It will, however, satisfy my (morbid) curiosity about whether or not it's possible. It carries along all the usual security concerns of any language's "eval." Make sure you trust the source of the code that is about to be compiled and executed with whatever privileges the program you used objc-eval in has.

Usage

Add to your project as you would any framework. You can either asynchronously evaluate with a delegate, or synchronously evaluate. Did I mention how stupid this is yet?

Example

OEEvaluation *evaluation = [OEEvaluation evaluationWithCode:@"return @\"Hello World!\";" delegate:nil]; NSLog([evaluation evaluateSynchronously]);

Something went wrong with that request. Please try again.