How to cancel NSBlockOperation

Doh. Dear future googlers: of course operation is nil when copied by the block, but it doesn’t have to be copied. It can be qualified with __block like so: //THIS MIGHT LEAK! See the update below. __block NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ while( ! [operation isCancelled]){ //do something… } }]; UPDATE: Upon further meditation, it … Read more

How to use “enumerateChildNodesWithName” with Swift in SpriteKit?

For now, don’t trust autocomplete to insert the code you need — it drops in signatures from the “header”, but a block signature is not the same as the declaration you need when inserting your own closure for a block parameter. The formal way to write a closure would be to replicate the signature inside … Read more

tech