Objective-C Coding Editor for Technical Interviews

Running Clang 6 with GNUstep and libobjc2 - Autocomplete is not available

While we don’t run Objective-C on native OSX, we do run it in the latest clang with objc. This lets you include classes like NSString and so forth largely as you normally would.

Your code is compiled with

clang `gnustep-config --objc-flags` `gnustep-config --objc-libs` \ -fobjc-arc -fobjc-nonfragile-abi -lobjc -lgnustep-base -ldispatch
Code language: Objective-C (objectivec)

which activates automatic reference counting and the nonfragile ABI.

You should define an int main() function.

To use the linked implementation of Apple’s Grand Central Dispatch, call the appropriate dispatch methods:

#import <stdio.h> #include <dispatch/dispatch.h> static void timer_did_fire(void *context) { printf("Strawberry fields...\n"); } int main (int argc, const char * argv[]) { dispatch_source_t timer = dispatch_source_create( DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); dispatch_source_set_event_handler_f(timer, timer_did_fire); dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0.5 * NSEC_PER_SEC); dispatch_resume(timer); dispatch_main(); }
Code language: Objective-C (objectivec)

Try Our Objective-C Editor