---
title: gState()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nswindow/gstate()
---

# gState()

Returns the window’s graphics state object.

## Declaration

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

## Return Value

Return Value The graphics state object associated with the window.

## Discussion

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().

## See Also

### Methods

- [canStoreColor()](appkit/nswindow/canstorecolor().md)
- [enableFlushing()](appkit/nswindow/enableflushing().md)
- [disableFlushing()](appkit/nswindow/disableflushing().md)
- [flush()](appkit/nswindow/flush().md)
- [flushIfNeeded()](appkit/nswindow/flushifneeded().md)
- [menuChanged(_:)](appkit/nswindow/menuchanged(_:).md)
- [cacheImage(in:)](appkit/nswindow/cacheimage(in:).md)
- [restoreCachedImage()](appkit/nswindow/restorecachedimage().md)
- [discardCachedImage()](appkit/nswindow/discardcachedimage().md)
- [useOptimizedDrawing(_:)](appkit/nswindow/useoptimizeddrawing(_:).md)
- [init(windowRef:)](appkit/nswindow/init(windowref:).md)
