<!--
{
  "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/ivar_getOffset(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:@F@ivar_getOffset"
  },
  "title" : "ivar_getOffset(_:)"
}
-->

# ivar_getOffset(_:)

Returns the offset of an instance variable.

```
func ivar_getOffset(_ v: Ivar) -> Int
```

## Discussion

For instance variables of type `id` or other object types, call [`object_getIvar(_:_:)`](/documentation/ObjectiveC/object_getIvar(_:_:)) and [`object_setIvar(_:_:_:)`](/documentation/ObjectiveC/object_setIvar(_:_:_:)) instead of using this offset to access the instance variable data directly.

---

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)