top of page

Re-indent code after editing in Xcode

Writer's picture: Shubham BakshiShubham Bakshi

Consider the following example which is pretty straight forward:

Let say you change the method signature and add async throws to it, you'll have to change the caller accordingly which, to be honest, messes up the look and feel:

How the change of code messes up the indent

To resolve this you can do the following:

  1. Select the piece of code that feels out of place because of entering new keyword/s

  2. Press control(or Ctrl)+i key and it will re-indent the code:

How to re-indent the messed up code

Site's author picture

Shubham Bakshi

Been coding since '13. Rode the Apple bandwagon in '18. Some can say it was love at first byte. I engineer apps with such finesse, they practically dance through your device. And if you're a dev feeling lost in the code jungle, fear not! I'm here to be your coding compass, guiding you through the wilderness of curly braces and semicolons.

Website logo
© Bits & Bytes w/ Bakshi. All rights reserved.
bottom of page