Develop
2015.09.17 07:53

[ios] How to set up clang formatter

Views 1360 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

How to set up clang formatter

 

Step 1:
Install alcatraz (http://alcatraz.io). Alcatraz is a package manager for Xcode.
How to install? Simply run:
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh

Step 2:
In Xcode, go to Window -> Package manager.
Search for clangformat.
Click on the folder/briefcase like icon on the left, to install clangformat plugin.
It installs pretty quickly and it might not tell you that it is installed. Do not tap on the folder/briefcase icon again, it will uninstall the plugin.
Close and re-open the package manager, search for clangformat, folder/briefcase like icon should be blue now. That'd indicate that clangformat plugin is now installed.
Restart Xcode
You can read more about clangformat plugin here: https://github.com/travisjeffery/ClangFormat-Xcode . It is based on clang-format.

Step 3:
In Xcode, go to Edit -> Clang Format. Pick "File".
This will ensure that auto-formatter uses our custom formatting preferences file located at apps/shopkick/iphone/Shopkick/.clang-format and lib/iphone/.clang-format.
We're following a slight variation of LLVM coding style.

Step 4:
In Xcode, go to Edit -> Clang Format. Pick "Enable format on save".
This will auto format your code when you save it.
When you are touching the code that hasn't been auto-formatted before, it is recommended that you auto-format it first and place the diff in a separate commit. Your code reviewer will thank you.

?

List of Articles
No. Category Subject Author Date Views
697 Develop [c] 네트워크 정보 알아보기 file hooni 2013.04.23 16123
696 Develop OGNL(Object Graph Navigation Language) hooni 2013.04.23 15729
695 Develop [ios] APNS 클라이언트 구현 (pdf) file hooni 2013.06.27 15691
694 Develop [c] 윈도우 API sin 함수 출력.. file hooni 2013.04.23 15668
693 Develop [ios] UI컨트롤러 샘플코드 hooni 2013.08.08 15424
692 Develop [js] 수학 공식을 제공하는 Math 객체 hooni 2013.04.23 15412
691 Develop [android] 해상도 관련 팁 (dip -> pixel 변환) hooni 2013.04.23 15333
690 Develop [c++] mfc 기반 레지스트리(registry) 컨트롤 예제 코드 2 hooni 2013.04.23 15332
689 Develop [java] 입출력 스트림 1부 (문자) file hooni 2013.04.23 15293
688 Develop [erp] SAP 모듈 요약 hooni 2013.04.23 15284
687 Develop [js] 간단한 게임 프로토타입 (HTML5 와는 무관) hooni 2013.04.23 15152
686 Develop [c] GD라이브러리(jpeg)를 사용한 웹 카운터 샘플 hooni 2013.04.23 15107
685 Develop [c++][mfc] 파일 입출력 샘플 (한줄씩 읽어서 다른 파일에 쓰기) hooni 2013.04.23 14984
684 Develop [unix] 쉘 스크립트 예제 모음 hooni 2003.04.23 14949
683 Develop [ios] UIWebView에서 NSURLRequest에 Cookie 실어 보내기 hooni 2014.01.16 14859
682 Develop [unix] 날짜 관련 쉘 명령어 (특정일 또는 +-시간, 날짜 계산된 값) hooni 2013.04.23 14807
Board Pagination Prev 1 ... 8 9 10 11 12 ... 53 Next
/ 53