How can I indent multiple lines in Xcode?

Select your code to reindent, then Go to

Editor -> Structure -> Re-Indent


The keyboard shortcuts are +] for indent and +[ for un-indent.

  • In Xcode's preferences window, click the Key Bindings toolbar button. The Key Bindings section is where you customize keyboard shortcuts.

Here are the shortcuts, to format the code in XCode

  1. Format entire code (entire class/controller)

    Select the entire code and press control+I on mac to format your code.

  2. Format particular block of code

    Select the code and press:

    • +] for right move (indent)
    • +[ for left move (un-indent)

Note: as per @JavierGiovannini sugesstion you can do using Editor Menu option

  1. Select your code and navigate to Editor > Structure > Re-Indent

+ [ and + ] are the equivalents to shift+tab in Xcode.