Search code examples
iphoneobjective-ciosxcodexcode4

Is there a way to change bracket placement and indentation in Xcode?


I want to change the default behavior of XCode (4) for aligning brackets from this:

- (BOOL)someValue {
    return _someValue;
}

To this:

- (BOOL)someValue
{
    return _someValue;
}

I've reviewed the docs here:

http://developer.apple.com/library/ios/#documentation/DeveloperTools/Reference/XcodeUserDefaultRef/100-Xcode_User_Defaults/UserDefaultRef.html#//apple_ref/doc/uid/TP40005535-CH3-SW57

But I still dont' understand how to make the change. Any help?


Solution

  • First off, the documentation you referred to is for XCode 3.1 (I've linked the introduction page which says so clearly). Judging by the number of comments on devforums.apple.com about this, I think the XCCodeSenseFormattingOptions key no longer exists under the new XCode4 defaults (which are stored under bundle ID com.apple.dt.XCode). If you want this particular feature restored, file a bug with Apple.

    Secondly, you might be able to do what you're looking for by modifying templates. I discovered this very related question, but there's no tacit confirmation there that the suggestion actually succeeded.