Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use code formatter in Xcode for Swift?

Xcode code formatter Swift

I'm trying to auto format my code written in Swift. It's necessary if you're working in team and using CVS and don't want to merge for hours.

Ctrl+I just makes an indent, but for example i want to have proper space between functions and just all the stuff like in Clang.

like image 548
S. Birklin Avatar asked Nov 18 '14 12:11

S. Birklin


People also ask

How do I format code in Xcode?

Select first the text you want to format and then press Ctrl + I . Use Cmd + A first if you wish to format all text in the selected file.

Does Xcode have Formatter?

The reformat code command in xcode is Ctrl-I, not Cmd-I and it appears to work just fine.

What is Formatter in Swift?

An abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values.


1 Answers

The reformat code command in xcode is Ctrl-I, not Cmd-I and it appears to work just fine.

like image 65
CuriousRabbit Avatar answered Sep 26 '22 19:09

CuriousRabbit