Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The latest (about 2 months old or so) update to uncrustify almost solves the problem. Just set the following items in your config file:</p> <pre><code>indent_oc_block = true indent_with_tabs = 0 indent_columns = 4 # set to the same as indent_switch_case indent_switch_case = 4 # set to the same as indent_columns </code></pre> <p>(I used indent_with_tabs = 0 because I could't get it to work with tabs. Probably not necessary.)</p> <p>And of course, for new line after/before {} set all you want of the nl_some_parameter_brace to "force".</p> <p>Now uncrustify will handle <em>your</em> code, it will not insert new lines into blocks for you, code like this will remain ugly:</p> <pre><code>dispatch_async(dispatch_get_global_queue(0, 0), ^(void) { //code } </code></pre> <p>If someone finds a way to make it insert new lines appropriately, please tell me.</p> <p>Thanks @ipmcc for the update on uncrustify.</p> <p>Edit: Yes, xCode obfuscates the code whenever you copy/paste. I use this great xCode plugin to ease the workflow: <a href="https://github.com/benoitsan/BBUncrustifyPlugin-Xcode" rel="nofollow">https://github.com/benoitsan/BBUncrustifyPlugin-Xcode</a></p> <p>Edit 2: Uncrustify does not handle nested blocks very well (still better than Xcode). Eg, nested blocks becomes:</p> <pre><code>dispatch_async(dispatch_get_global_queue(0, 0), ^(void) { [array enumerateObjectsUsingBlock:^(id object, NSUInteger index, BOOL *stop) { [array enumerateObjectsUsingBlock:^(id object, NSUInteger index, BOOL *stop) { NSLog(@"the pumpkin pie!"); }]; }]; }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload