<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSXPCInterface/setClasses(_:for:argumentIndex:ofReply:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSXPCInterface(im)setClasses:forSelector:argumentIndex:ofReply:"
  },
  "title" : "setClasses(_:for:argumentIndex:ofReply:)"
}
-->

# setClasses(_:for:argumentIndex:ofReply:)

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

```
func setClasses(_ classes: Set<AnyHashable>, for sel: Selector, argumentIndex arg: Int, ofReply: Bool)
```

## 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 <doc://com.apple.documentation/documentation/Swift/true> if `arg` is an index into the parameters of the reply block, or <doc://com.apple.documentation/documentation/Swift/false> 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)