Mac Developer Library

Developer

Foundation Framework Reference NSProtocolChecker Class Reference

Options
Deployment Target:

On This Page
Language:

NSProtocolChecker

More...

Inheritance


Conforms To


Import Statement


import Foundation @import Foundation;

Availability


Available in OS X v10.0 and later.
  • Allocates and initializes an NSProtocolChecker instance that will forward any messages in aProtocol to anObject, the protocol checker’s target.

    Declaration

    Objective-C

    + (instancetype)protocolCheckerWithTarget:(NSObject *)anObject protocol:(Protocol *)aProtocol

    Discussion

    Thus, the checker can be vended in lieu of anObject to restrict the messages that can be sent to anObject. Returns the new instance.

    Import Statement

    Availability

    Available in OS X v10.0 and later.

  • Initializes a newly allocated NSProtocolChecker instance that will forward any messages in aProtocol to anObject, the protocol checker’s target.

    Declaration

    Swift

    init(target anObject: NSObject, `protocol` aProtocol: Protocol)

    Objective-C

    - (instancetype)initWithTarget:(NSObject *)anObject protocol:(Protocol *)aProtocol

    Discussion

    Thus, the checker can be vended in lieu of anObject to restrict the messages that can be sent to anObject. If anObject is allowed to be freed or dereferenced by clients, the free method should be included in aProtocol.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the protocol object the receiver uses.

    Declaration

    Swift

    var `protocol`: Protocol { get }

    Objective-C

    @property(readonly) Protocol *protocol

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the target of the receiver.

    Declaration

    Swift

    var target: NSObject? { get }

    Objective-C

    @property(readonly, retain) NSObject *target

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.