<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/class",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(cm)class"
  },
  "title" : "class"
}
-->

# class

Returns the class object.

```
+ (Class) class;
```

## Return Value

The class object.

## Discussion

Refer to a class only by its name when it is the receiver of a message. In all other cases, the class object must be obtained through this or a similar method. For example, here `SomeClass` is passed as an argument to the [`isKind(of:)`](/documentation/ObjectiveC/NSObjectProtocol/isKind(of:)) method (declared in the `NSObject` protocol):

```objc
BOOL test = [self isKindOfClass:[SomeClass class]];
```

## See Also

  <doc://com.apple.documentation/documentation/Foundation/NSStringFromClass(_:)>

[`- (Class) class;`](/documentation/ObjectiveC/NSObject-c.protocol/class)

Returns the class object for the receiver’s class.

  <doc://com.apple.documentation/documentation/Foundation/NSClassFromString(_:)>



---

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)