Indentation Edit on GitHub
Because components are often deeply nested structures, it’s rarely possible to fit them on one line. We’ve developed some best practices for indentation unique to Components code. These rules should generally not be applied to non-Components code.
- Put a newline before
new, so that parameters left-align instead of aligning by semicolon.
- Put a newline after
:if the parameter value stretches to multiple lines.
- Consider putting a newline after
returnif it reduces nesting.
These are guidelines, not ironclad rules. Feel free to ignore them on a case-by-case basis.
This is hard to read:
Within a statement, indent by only one space.
You never have to indent manually. After inserting newlines as described above, use
Ctrl-I (Editor ▶︎ Structure ▶︎ Re-Indent) to make Xcode do the indentation work for you.