code_junkie

Category usage in Objective-C

Nov 12th, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. @interface SomeClass (private)
  2.  
  3. @interface NSString (Capitals)
  4.  
  5. -(NSString *)alternateCaps:(NSString *)aString;
  6.  
  7. @end
  8.  
  9. @implementation NSString (Capitals)
  10. -(NSString *)alternateCaps:(NSString *)aString
  11. {
  12. // Implementation
  13. }
  14.  
  15. // someClass.m
  16. @interface someClass (extension)
  17. -(void)extend;
  18. @end
  19.  
  20. @implementation someClass
  21. // all the methods declared in the .h file and any superclass
  22. // overrides in this block
  23. @end
  24.  
  25. @implementation someClass (extension)
  26. -(void)extend {
  27. // implement private method here;
  28. }
  29.  
  30. // someClass.m
  31. @interface someClass ()
  32. -(void)extend;
  33. @end
  34.  
  35. @implementation someClass
  36. // all the methods declared in the .h file and any superclass
  37. // overrides in this block
  38. // Implement private methods in this block as well.
  39. -(void)extend {
  40. // implement private method here;
  41. }
  42.  
  43. @end
Add Comment
Please, Sign In to add comment