<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/gState()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(im)gState"
  },
  "title" : "gState()"
}
-->

# gState()

Returns the window’s graphics state object.

```
func gState() -> Int
```

## Return Value

The graphics state object associated with the window.

## Discussion

This graphics state is used by default for all `NSView` objects in the window’s view hierarchy, but individual views can be made to use their own with the `NSView` method [`allocateGState()`](/documentation/AppKit/NSView/allocateGState()).

---

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)