Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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
Advertisement
Add Comment
Please, Sign In to add comment