Mac Developer Library

Developer

Foundation Framework Reference NSXPCInterface Class Reference

Options
Deployment Target:

On This Page
Language:

NSXPCInterface

Class that describes the methods that may be sent to an exported object or remote object proxy.

This object holds all information about the interface of an exported object or remote object proxy. It describes what messages are allowed, what kinds of objects are allowed as arguments, what the signature of any reply blocks are, and information about additional proxy objects.

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.8 and later.
  • Returns the current list of allowed classes that can appear within the specified collection object argument to the specified method.

    Declaration

    Swift

    func classesForSelector(_ sel: Selector, argumentIndex arg: Int, ofReply ofReply: Bool) -> NSSet

    Objective-C

    - (NSSet *)classesForSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply

    Parameters

    sel

    Specifies which method in the protocol you want information about.

    arg

    Specifies the position (starting at index 0) of the parameter for which you want to obtain the current set of allowed classes. This may be either the position of a parameter in the method itself or the position in its reply block.

    ofReply

    Pass YEStrue if arg is an index into the parameters of the reply block, or NOfalse if it is an index into the parameters of the method itself.

    Discussion

    See setClasses:forSelector:argumentIndex:ofReply: for more explanation.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • Returns the interface previously set for the specified selector and parameter.

    Declaration

    Swift

    func interfaceForSelector(_ sel: Selector, argumentIndex arg: Int, ofReply ofReply: Bool) -> NSXPCInterface?

    Objective-C

    - (NSXPCInterface *)interfaceForSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply

    Parameters

    sel

    Specifies which method in the protocol you want information about.

    arg

    Specifies the position (starting at index 0) of the parameter for which you want to obtain the current interface. This may be either the position of a parameter in the method itself or the position in its reply block.

    ofReply

    Pass YEStrue if arg is an index into the parameters of the reply block, or NOfalse if it is an index into the parameters of the method itself.

    Discussion

    See setInterface:forSelector:argumentIndex:ofReply: for more explanation.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • Sets the classes that can appear within the (numerically) specified collection object argument to the specified method.

    Declaration

    Swift

    func setClasses(_ classes: NSSet, forSelector sel: Selector, argumentIndex arg: Int, ofReply ofReply: Bool)

    Objective-C

    - (void)setClasses:(NSSet *)classes forSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply

    Parameters

    classes

    An NSSet containing Class objects—for example, [MyObject class].

    sel

    Specifies which method in the protocol is being configured.

    arg

    Specifies the position (starting at index 0) of the parameter for which you are allowing classes. This may be either the position of a parameter in the method itself or the position in its reply block.

    ofReply

    Pass YEStrue if arg is an index into the parameters of the reply block, or NOfalse if it is an index into the parameters of the method itself.

    Discussion

    If an argument to a method in your protocol is a collection class (for example, NSArray or NSDictionary), then you must explicitly specify the set of expected classes that may appear within that collection.

    If the expected classes are all property list types, calling this method is optional; property list types are allowed by default inside collection objects. You may, however, call this method to further restrict the set of allowed classes.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • Configures a specific parameter of a method to be sent as a proxy object instead of copied.

    Declaration

    Swift

    func setInterface(_ ifc: NSXPCInterface, forSelector sel: Selector, argumentIndex arg: Int, ofReply ofReply: Bool)

    Objective-C

    - (void)setInterface:(NSXPCInterface *)ifc forSelector:(SEL)sel argumentIndex:(NSUInteger)arg ofReply:(BOOL)ofReply

    Parameters

    ifc

    The NSXPCInterface object that describes the protocol for the proxy object. The interface is configured the same way as the interface for an exported object or remote object proxy.

    sel

    Specifies which method in the protocol is being configured.

    arg

    Specifies the position (starting at index 0) of the parameter for which you are configuring a proxy object. This may be either the position of a parameter in the method itself or the position in its reply block. This argument must be an object.

    ofReply

    Pass YEStrue if arg is an index into the parameters of the reply block, or NOfalse if it is an index into the parameters of the method itself.

    Discussion

    If an argument to a method in your protocol should be sent as a proxy object instead of by copy, then configure the interface for that protocol with a new interface for a specific argument. An example of an object that should be a proxy instead of being copied is a view object.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • Returns an NSXPCInterface instance for a given protocol.

    Declaration

    Swift

    init(`protocol` `protocol`: Protocol) -> NSXPCInterface

    Objective-C

    + (NSXPCInterface *)interfaceWithProtocol:(Protocol *)protocol

    Discussion

    Most interfaces do not need any further configuration. Interfaces with collection classes or additional proxy objects should be configured using the other methods in this class.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

  • protocol protocol Property

    The Objective-C protocol that this interface is based on.

    Declaration

    Swift

    unowned(unsafe) var `protocol`: Protocol

    Objective-C

    @property(assign) Protocol *protocol

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.