layout | title | description | redirect_from | ||
---|---|---|---|---|---|
default |
Objective-C guide: block syntax |
A quick reference guide for block syntax in Objective-C. |
|
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
@property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes);
- (void)methodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName;
[someObject methodThatTakesABlock:^returnType (parameters) {...}];
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};