<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObjectProtocol/isMember(of:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(pl)NSObject(im)isMemberOfClass:"
  },
  "title" : "isMember(of:)"
}
-->

# isMember(of:)

Returns a Boolean value that indicates whether the receiver is an instance of a given class.

```
func isMember(of aClass: AnyClass) -> Bool
```

## Parameters

`aClass`

A class object representing the Objective-C class to be tested.

## Return Value

[`YES`](/documentation/ObjectiveC/YES) if the receiver is an instance of `aClass`, otherwise [`NO`](/documentation/ObjectiveC/NO).

## Discussion

For example, in this code, [`isMember(of:)`](/documentation/ObjectiveC/NSObjectProtocol/isMember(of:)) would return [`NO`](/documentation/ObjectiveC/NO):

```objc
NSMutableData *myData = [NSMutableData dataWithCapacity:30];
id anArchiver = [[NSArchiver alloc] initForWritingWithMutableData:myData];
if ([anArchiver isMemberOfClass:[NSCoder class]])
    ...
```

Class objects may be compiler-created objects but they still support the concept of membership. Thus, you can use this method to verify that the receiver is a specific Class object.

---

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)