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;

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.