Guest User

Untitled

a guest
Jun 4th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // This goes in the header that users of your framework/static lib can use:
  2.  
  3. @interface MyPublicClass : NSObject
  4. {
  5. struct MyPublicClassIVars *ivars;
  6. }
  7.  
  8. @property (assign) int myInt;
  9.  
  10. @end
  11.  
  12.  
  13. // ----------
  14. // This goes in the implementation file that gets compiled into the library and thus never gets seen by clients:
  15.  
  16. struct MyPublicClassIVars
  17. {
  18. int myInt;
  19. };
  20.  
  21.  
  22. @implementation MyPublicClass
  23.  
  24. -(id) init
  25. {
  26. if(( self = [super init] ))
  27. {
  28. ivars = calloc( 1, sizeof(struct MyPublicClassIVars) );
  29. }
  30. return self;
  31. }
  32.  
  33.  
  34. -(void) dealloc
  35. {
  36. free( ivars );
  37. [super dealloc];
  38. }
  39.  
  40.  
  41. -(void) setMyInt: (int)theInt
  42. {
  43. ivars->myInt = theInt;
  44. }
  45.  
  46.  
  47. -(int) myInt
  48. {
  49. return ivars->myInt;
  50. }
  51.  
  52. @end
Advertisement
Add Comment
Please, Sign In to add comment