Skip to content

Instantly share code, notes, and snippets.

View erikkerber's full-sized avatar
📱
One of the "OK" ones

Erik Kerber erikkerber

📱
One of the "OK" ones
View GitHub Profile
// As a local variable.
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
// As a property.
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);
// As a method parameter.
- (void)someMethodThatTakesABlock:(returnType (^)(parameterTypes))blockName {...}
// As an argument to a method call.
// clang -fobjc-arc -framework Foundation runtime-class.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface Person : NSObject
- (id)initWithFirstName: (NSString *)firstName lastName: (NSString *)lastName age: (NSUInteger)age;