See this comment from for details:
✔️1. For nested directives, can we either
a) Keep the original indentation, or
b) re-indent nested blocks
... so that the result looks similar to the original Objective-C code?
✔️2. Indent code inside successfully converted availability directives (implemented via postprocessor in ).
a) It seems to be possible only if indentations are kept during conversion. If they were set immediately there, it would affect main indents or break SwiftPostProcessor methods where these directives are considered as starters in respective lines(perhaps it might be changed).
b) There are so many directives, I’m no sure it would be possible for all nested cases.
I implemented plain indentations for the non-nested availability directives in the Feature/IndentConvertedDirectives branch.
Converted fragment from GCHTTPRequestOperation.m
If you consider such approach as appropriate, I’ll continue(and merge it into the AvailabilitySupportbranch or stay as a completely separate task).
1. Just made this test, and the result looks awesome.
Nested directives are supported.
Add a unit test and we’re done here.
2. This looks awesome to me.
Please add unit test(s) for your sample case(s) and I guess we are done with this part.
3. With the sample.m file that you provided, I see extra indents in the code:
See if you can fix this.
I guess that’s because some code blocks are repeatedly indented.
That’s the difference between Indent(context, level) and IndentBy(level).
Thanks, yes I indented branches' lines inaccurately and manually instead of just using `IndentBy`. I’ll refactor it.