Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Creating an NSRunLoop for a command line utility.
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
NSRunLoop * runLoop;
CLIMain * main; // replace with desired class
// create run loop
runLoop = [NSRunLoop currentRunLoop];
main = [[CLIMain alloc] init]; // replace with init method
// kick off object, if required
[main start];
// enter run loop
while((!(main.shouldExit)) && (([runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:2]])));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.