What is the '^' in Objective-C

What does the ‘^’ mean in the code below?

@implementation AppController

- (IBAction) loadComposition:(id)sender
{
    void (^handler)(NSInteger);

    NSOpenPanel *panel = [NSOpenPanel openPanel];

    [panel setAllowedFileTypes:[NSArray arrayWithObjects: @"qtz", nil]];

    handler = ^(NSInteger result) {
        if (result == NSFileHandlingPanelOKButton) {
            NSString *filePath = [[[panel URLs] objectAtIndex:0] path];
            if (![qcView loadCompositionFromFile:filePath]) {
                NSLog(@"Could not load composition");
            }
        }
    };

    [panel beginSheetModalForWindow:qcWindow completionHandler:handler];
}
@end

===
I’ve searched and searched – is it some sort of particular reference to memory?

  • NSHTTPCookieStorage state not saved on app exit. Any definitive knowledge/documentation out there?
  • How to stop an NSInvocationOperation?
  • Why are umbrella frameworks discouraged?
  • Use iTunes' Up Next function with an API
  • Downloading “mobileconfig” file from an App
  • What's the equivalent of Java's Thread.sleep() in Objective-C/Cocoa?
  • 4 Solutions Collect From Internet About “What is the '^' in Objective-C”

    Read up on it here. It’s a “Block object”, which is basically a lambda form, and was introduced to support Snow Leopard’s GCD (Grand Central Dispatch).

    Small aside: the ‘^’ character (caret or circumflex character) has a different meaning when used as a binary operator:

    a ^ b
    

    means a XOR b. XOR (aka exclusive OR) is a binary arithmetic operation where the the result has a 1 in any bit position where either a or b had a 1 but not both.

    It is a block (a.k.a. closure), an extension of C created by Apple.

    It is a block, likely for use with Grand Central Dispatch.