
Untitled
By: a guest on
Jun 4th, 2012 | syntax:
None | size: 0.76 KB | hits: 10 | expires: Never
// This goes in the header that users of your framework/static lib can use:
@interface MyPublicClass : NSObject
{
struct MyPublicClassIVars *ivars;
}
@property (assign) int myInt;
@end
// ----------
// This goes in the implementation file that gets compiled into the library and thus never gets seen by clients:
struct MyPublicClassIVars
{
int myInt;
};
@implementation MyPublicClass
-(id) init
{
if(( self = [super init] ))
{
ivars = calloc( 1, sizeof(struct MyPublicClassIVars) );
}
return self;
}
-(void) dealloc
{
free( ivars );
[super dealloc];
}
-(void) setMyInt: (int)theInt
{
ivars->myInt = theInt;
}
-(int) myInt
{
return ivars->myInt;
}
@end