NSDate でカテゴリを作成しています。パブリック インターフェイスの一部であってはならないユーティリティ メソッドがいくつかあります。
どうすれば非公開にできますか?
クラスでプライベート メソッドを作成するときは、「匿名カテゴリ」のトリックを使用する傾向があります。
@interface Foo()
@property(readwrite, copy) NSString *bar;
- (void) superSecretInternalSaucing;
@end
@implementation Foo
@synthesize bar;
.... must implement the two methods or compiler will warn ....
@end
しかし、別のカテゴリ内では機能しないようです:
@interface NSDate_Comparing() // This won't work at all
@end
@implementation NSDate (NSDate_Comparing)
@end
カテゴリにプライベート メソッドを含める最良の方法は何ですか?