본문 바로가기
Tool&Util/Xcode

Xcode 4.2이하에서 코드 블럭 스타일 변경하기

by 백룡화검 2012. 8. 4.
출처 : http://forrst.com/posts/Put_that_where_it_might_belong_Xcode-PNL

Put that { where it (might) belong, Xcode!

http://github.com/sveinungkb/ios-convenience/blob/master/SystemCodeSnippets.codesnippets

sveinungkb

Sveinung Kval Bakken

10 months ago · 713 views

After some poking around in Xcode 4.2´s files, I finally found a way to edit all the if, switch, class, methods etc snippets to have the opening curly brace on its own line. This is our convention, and I bet we´re not alone. Adding a manual new line for every if-statement is waste of good brain power, so why not let Xcode do it right in the first place?

If your convention is something else, keep using it, if you´re cool - and want your if statements like this:

if (YES)
{
   
NSLog(@"Tidy code == win!");
}

Then: * Quix Xcode

  • Make a backup of your /Developer/Library/Xcode/PrivatePlugIns/IDECodeSnippetLibrary.ideplugin/Contents/Resources/SystemCodeSnippets.codesnippets

  • Make another backup if you intend to screw something up

  • Create a file on your desktop called: SystemCodeSnippets.codesnippets

  • Download the linked file to your desktop

  • Copy your desktop´s SystemCodeSnippets.codesnippets to /Developer/Library/Xcode/PrivatePlugIns/IDECodeSnippetLibrary.ideplugin/Contents/Resources/SystemCodeSnippets.codesnippets

  • Start Xcode

  • Type wonderful if, else, switch and for statements, all day long! <3