-
Notifications
You must be signed in to change notification settings - Fork 573
Code style guide
While I prefer tabs, I think Xcode may be defaulting to 4 spaces now. So use either real tabs or 4 spaces to indent stuff.
Put the curly braces of method bodies on their own lines, but inline for if/else/etc blocks:
- (void)addClip
{
[self _setContextPath];
if (_usesEvenOddFillRule) {
CGContextEOClip(UIGraphicsGetCurrentContext());
} else {
CGContextClip(UIGraphicsGetCurrentContext());
}
}
For member variables and methods, prefix them with an underscore to reduce the chance of conflicting with applications which may subclass framework classes.
If you need to reference private methods from outside of a class implementation, create a UIPrivate
category in its own file to keep it out of the public header file. See the other files with private headers to learn the conventions being used in this case.
If you need a non-standard extension to a class, put that interface in an AppKitIntegration
category. Again, put this category in its own file and do not include it in any public headers except for AppKitIntegration.h
. Keep the default public interface to Chameleon as identical to Apple's interfaces as possible. AppKitIntegration extensions are opt-in by third party apps.