Conforming protocol privately
Is there any way to hide protocol conforming from an end user? I'll try to describe in details what I want. I have class let's call it EndUserClass which conforms some protocol let's say HiddenClassDelegate and this protocol I'd like to hide from end user. The code looks like as it follows:
@interface EndUserClass : NSObject <HiddenClassDelegate>
{
// .....
}
@end
and I want to keep the same functionality with the following declaration:
@int开发者_JAVA百科erface EndUserClass : NSObject
{
// .....
}
@end
Is there any way to conform the protocol privately? I know that I can skip delegate in class declaration but it gives compiler warning which I don't want to have
You can do that by declaring custom class category in implementation file:
// .m file
@interface EndUserClass() <HiddenClassDelegate>
@end
精彩评论