Contents

Develop
2015.09.17 07:53

[ios] How to set up clang formatter

조회 수 1353 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

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
번호 분류 제목 글쓴이 날짜 조회 수
841 Develop [ios] 아이폰용 앱 오픈 소스들 hooni 2013.04.23 466573
840 Develop [ios] 언어, 지역, 국가 설정 가져오기 hooni 2014.05.12 269555
839 Develop 자주 쓰는 Docker 명령어 alias hooni 2020.01.10 269144
838 Develop [ios] Start developing your navigation app for CarPlay without enrollment file hooni 2020.02.22 124683
837 Develop [android] 만화 어플 소스코드 file hooni 2013.04.23 92834
836 Develop 레고 마인드스톰 NXT 수도쿠, 큐브 소스코드.. 20 file hooni 2013.04.23 81396
835 Develop [c#] Hashtable <-> Json (dll 포함) file hooni 2013.04.23 80650
834 Develop [C#] MD5, SHA1 해시 & 인코딩 hooni 2013.04.23 77853
833 Develop [android] 점심 해결 앱 소스 코드 ㅋㅋ file hooni 2013.04.23 76394
832 Develop [json] 종결자 (설명과 웹, C/C++/C# 프로그램 샘플 코드) file hooni 2013.04.23 71969
831 Develop [android] keytool을 사용하여 키스토어 생성 hooni 2013.04.23 69510
830 Develop [ios] Random Thoughts: Rand() vs. arc4random() hooni 2013.10.31 68037
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 71 Next
/ 71