Skip to content

Instantly share code, notes, and snippets.

@jonathanpenn
Created September 6, 2010 00:01
Show Gist options
  • Save jonathanpenn/566457 to your computer and use it in GitHub Desktop.
Save jonathanpenn/566457 to your computer and use it in GitHub Desktop.
// I don't usually touch the AppDelegate anywhere else in the program
// so I'm not sure if this solves what you're trying to do or not.
// But, this should show the difference of how to declare public vs.
// private properties.
@interface SomeClass : NSObject {
// If you use LLVM then you don't have to declare the private var!!
}
@property (nonatomic, retain) NSString *somePublicStringProperty;
@end
#include "SomeObject.h"
@interface SomeClass () // <- Empty parens means it's an anonymous category
// That makes it, in essence, private.
@property (nonatomic, retain) NSString *somePrivateStringProperty;
@end
@implementation SomeClass
@synthesize somePublicStringProperty, somePrivateStringProperty;
- (void)dealloc
{
self.somePublicStringProperty = nil;
self.somePrivateStringProperty = nil;
[super dealloc];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment