<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSGraphicsContext/setGraphicsState(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSGraphicsContext(cm)setGraphicsState:"
  },
  "title" : "setGraphicsState(_:)"
}
-->

# setGraphicsState(_:)

Makes the graphics context of the specified graphics state current, and resets graphics state.

```
class func setGraphicsState(_ gState: Int)
```

## Discussion

The `graphicState` identifier must be created in the calling thread.

---

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)