Code Formatting In Xcode

前端 未结 12 1820
名媛妹妹
名媛妹妹 2020-12-09 02:01

Is there anyway to format the code in Xcode like you can do in Eclipse or Netbenas. I have not found any option in menu, is there any hot key for this or its simply not in X

相关标签:
12条回答
  • 2020-12-09 02:47

    My personal favorite code formatter is Uncrustify. It has many, many options, so I also suggest you download UniversalIndentGUI, a GUI to help set Uncrustify's behavior to your liking.

    0 讨论(0)
  • 2020-12-09 02:48

    If you love looking your code like me, you really need this shortcut :)

    You have to select with CMD + A for reformatting whole code segment.

    All you need to do this, select the code segment which you want to reformat it and press : Ctrl + I Magically, It is just reformatted

    0 讨论(0)
  • 2020-12-09 02:50

    You can also highlight the code you want to re indent, and use the re-indent command

    0 讨论(0)
  • 2020-12-09 02:50

    ^-I (control - capital i) : format the current line

    -A + ^-I : format the whole code file

    0 讨论(0)
  • 2020-12-09 02:56

    In Xcode 4, it's been moved to Editor > Structure > Re-Indent command (and has a default shortcut of CTRL+I ).

    0 讨论(0)
  • 2020-12-09 02:56

    Not saying this is best approach, but for completeness, if you cut and then paste the code back in, Xcode will automatically format it for you.

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