Writing stuff down. Mostly Code.

Documenting Specific F%&cking Syntax For The Examples On f%&ckingBlockSyntax.com

While I am enjoying Swift more and more, I still love Objective-C, and continue to work in it professionally. One of the biggest syntactic pain points in Objective-C is definitely blocks (closures for the non Objc).

When trying to write an Objective-C block from scratch, the majority of iOS developers turn immediately to fuckingBlockSyntax.com. (This is not a secret) Due to the slightly off-putting syntax that is different in different contexts.

But I often find myself slowed down for a couple minutes trying to turn the generalized syntax (below) into specific syntax:

As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};

Since getting the precise form remains a compiler-aided exercise at times, I decided to finally write out (void <- nil) and (NSString * <- NSArray *) blocks in all of their various uses. It's definitely a little tedious, but I wanted to have a "go to" reference for this. Maybe someone else will find it helpful