Possible Duplicate:
Conforming protocol privately
A class of mine tries to register itself as the delegate to a NSXMLParser object that it creates. However, I don't think I want my class to publicly disclose that it implements the NSXMLParserDelegate protocol, since that NSXMLParser object is a private variable used only from within the class.
Am I right to avoid disclosing the protocol, and if so, how do I implement the protocol without making it public that the class does so?
Try putting this in your .m file:
@interface MyClass (Private) <NSXMLParser>
@end
The specific category name (Private
) doesn't matter – in fact you can use an empty set of parentheses (see below) – but I think this should require you to implement the required methods and tell the compiler that your class implements the protocol, at least in that file.
If that doesn't work, try simply removing <NSXMLParser>
from your .h file, and casting self
to id<NSXMLParser>
if necessary, when setting the parser's delegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With