3 ms·
In every Objective-C API I've seen that uses blocks, the framework takes care of the "[[... copy] autorelease]" bit. In practice, the code looks something like
by panic 15y ago
In every Objective-C API I've seen that uses blocks, the framework takes care of the "[[... copy] autorelease]" bit. In practice, the code looks something like (to borrow your block with foos and bars):
[array transformFoos:^(Foo*) (Foo* bar) {
return bar;
}];
I'm not sure there is a more succinct way to write a lambda with typed arguments and a typed return value.