Is there a way to make Xcode not reformat formatted code, or is there a tool like uncrustify that can format source code that uses blocks?
With blocks in objective-c, code has become hard to read. One solution is to write out the block definition and put curly braces on new lines, like this:
dispatch_async(dispatch_get_global_queue(0, 0), ^(void)
{
//block of code
});
And:
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop)
{
//block of code
}];
Beautiful and easy!
But Xcode does not preserve this format, and I can't find a way to make uncrustify output code this way. Uncrustify is really good, but perhaps blocks are too new?
Any ideas?
[disclaimer: I know this may turn into "troll hour", but code should be as easy to read as possible, and having braces on the same column makes things much more clear (to me). Especially if you have several blocks within a block. So if you don't like code looking like this, please try to just ignore the question.]
^(void)
and then enter, the following brackets will be correctly placed. – Pish