<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/class_getClassVariable(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:@F@class_getClassVariable"
  },
  "title" : "class_getClassVariable(_:_:)"
}
-->

# class_getClassVariable(_:_:)

Returns the `Ivar` for a specified class variable of a given class.

```
func class_getClassVariable(_ cls: AnyClass?, _ name: UnsafePointer<CChar>) -> Ivar?
```

## Parameters

`cls`

The class definition whose class variable you wish to obtain.

`name`

The name of the class variable definition to obtain.

## Return Value

A pointer to an [`Ivar`](/documentation/ObjectiveC/Ivar) data structure containing information about the class variable specified by `name`.

## Discussion

---

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)