---
title: restoreGraphicsState()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsgraphicscontext/restoregraphicsstate()-swift.method
---

# restoreGraphicsState()

Removes the context’s graphics state from the top of the graphics state stack and makes the next graphics state the current graphics state.

## Declaration

```swift
func restoreGraphicsState()
```

## Discussion

Discussion This method must have been preceded with a saveGraphicsState() message to add the graphics state to the stack. Invocations of saveGraphicsState() and restoreGraphicsState() methods may be nested. Restoring the graphics state restores such attributes as the current drawing style, transformation matrix, color, and font of the original graphics state.

## See Also

### Managing the Graphics State

- [restoreGraphicsState()](appkit/nsgraphicscontext/restoregraphicsstate()-swift.type.method.md)
- [saveGraphicsState()](appkit/nsgraphicscontext/savegraphicsstate()-swift.type.method.md)
- [saveGraphicsState()](appkit/nsgraphicscontext/savegraphicsstate()-swift.method.md)
- [setGraphicsState(_:)](appkit/nsgraphicscontext/setgraphicsstate(_:).md)
