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 adjusting automatically.
In Visual Studio you can highlight code and select 'format selection' to fix these issues - is there anything similar in Xcode?
Choose Xcode > Preferences… from the menu bar (default shortcut: command-comma). Then click the “Text Editing” section. Then choose the “Indentation” tab.
Xcode can fix this with one shortcut: select the code you want to fix, then press Ctrl+I to reindent it.
Select the entire code and press control + I on mac to format your code. Select the code and press: ⌘ + ] for right move (indent)
Before Xcode 9 (for Xcode 9 see default shortcut below)
In XCode 4 there is one more step:
Or using the default shortcut:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With