From:How Do I Declare A Block in Objective-C?
简单翻译一下:
作为本地变量的声明方法:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
属性的声明:
@property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes);
作为方法的参数声明:
- (void)someMethodThatTakesABlock:(returnType (^nullability)(parameterTypes))blockName;
作为参数被方法调用的声明:
[someObject someMethodThatTakesABlock:^returnType (parameters) {...}];
作为结构体的声明方法:
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};