Fix code indentation in Xcode

前端 未结 9 923
时光取名叫无心
时光取名叫无心 2020-12-13 03:20

Once I start editing my code and adding for loops or if then statements my code indentation is whacked because the previous code maintains its former indentation instead of

相关标签:
9条回答
  • 2020-12-13 03:54

    Before Xcode 9 (for Xcode 9 see default shortcut below)

    1. select text
    2. right-click
    3. there's a "Re-indent selection" item in popup menu

    In XCode 4 there is one more step:

    1. select text
    2. right-click
    3. Click on "Structure"
    4. there's a "Re-indent selection" and other options in popup menu

    Or using the default shortcut:

    1. select text
    2. press ctrl + i
    0 讨论(0)
  • 2020-12-13 03:57
    1. select text
    2. press Control-I (the default keyboard shortcut)
    0 讨论(0)
  • 2020-12-13 03:57

    To quickly re-indent the whole file:

    +a

    +x

    +v

    Edit: No longer working in Xcode 11

    0 讨论(0)
提交回复
热议问题