O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSProtocolChecker — Mac OS X 10.0

Synopsis

This class is used to provide a proxy for an object (the protocol checker’s delegate) that filters messages sent to the object based on a formal protocol. Cocoa’s distributed objects system uses this class to improve the performance of a distributed objects connection by limiting the messages sent an object to those agreed upon in a protocol. Instances of NSProtocolChecker are initialized with the method initWithTarget:protocol:. Target: is the object the protocol check will act as a proxy for, while protocol: is the protocol that defines what methods will be forwarded to the target object by the protocol checker. Note that the argument type for protocol: is a protocol object: Protocol *. To obtain a pointer to a protocol, use the @protocol(protocolName) compiler directive.

image with no caption

@interface NSProtocolChecker : NSProxy
                                  // Initializers
   - (id)initWithTarget:(NSObject *)anObject 
                                 protocol:(Protocol *)aProtocol;
                                  // Class Methods
   + (id)protocolCheckerWithTarget:(NSObject *)anObject 
                                 protocol:(Protocol *)aProtocol;
                                  // Instance Methods
   - (Protocol *)protocol;
   - (NSObject *)target;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required