Fix code indentation in Xcode

前端 未结 9 922
时光取名叫无心
时光取名叫无心 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:36

    In Xcode 4.6.3, choose Editor > Structure > Re-Indent.

    Shortcut: Control + I (that's 'i', for 'indent')

    This works on current selection. If no text selected, choose Edit > Select All (⌘+A) and then perform the re-indent.

    (I'm more clearly restating the other answers)

    0 讨论(0)
  • 2020-12-13 03:39

    Xcode 9.2:

    You can select text and press ctrl + i to re-indent code.

    0 讨论(0)
  • 2020-12-13 03:39

    You can try my extension Swimat https://github.com/Jintin/Swimat

    It support format on selection.

    Simple install by brew cask install swimat

    0 讨论(0)
  • 2020-12-13 03:40

    You can do this automatically in Xcode 11

    0 讨论(0)
  • 2020-12-13 03:50

    These solutions re-indent text to the default xCode behaviors. To change these behaviors, go to xCode (v.4) > Preferences > Text Editing. Then to Indentation Tab.

    0 讨论(0)
  • 2020-12-13 03:50

    You can do it in different ways, but these two are the easiest

    • select text ( +a) :
    1. Using shortcut -> (control)^ + i

    2. Click on "Editor" -> Click on "Structure" -> Click on "Re-indent"

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