Skip to content

Instantly share code, notes, and snippets.

@abesmon
Created November 25, 2019 14:07
Show Gist options
  • Save abesmon/24b68371b7d5f397764c1d76b561c586 to your computer and use it in GitHub Desktop.
Save abesmon/24b68371b7d5f397764c1d76b561c586 to your computer and use it in GitHub Desktop.
about objc blocks

Also, there is some info on: http://fuckingblocksyntax.com

/// returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};

void (^printXAndY)(int) = ^(int y) {
    printf("%d %d\n", x, y);
};

printXAndY(4);

void (^blockName)(void) = ^void(void) {
  printf("hello world");
};

blockName();
object.property = ^(Foo* foo) {
  [foo doSmth];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment