---
title: PKStroke.RenderState
framework: pencilkit
role: symbol
role_heading: Structure
path: pencilkit/pkstroke-swift.struct/renderstate-swift.struct
---

# PKStroke.RenderState

A value that captures the render-time state of a stroke, such as grain texture position.

## Declaration

```swift
struct RenderState
```

## Mentioned in

Controlling stroke rendering for animation and editing

## Overview

Overview Use RenderState to preserve rendering fidelity when you manipulate strokes programmatically. For example, substrokes returned by substroke(range:) may include a renderState so that the extracted portion renders identically to the corresponding section of the original stroke. A value of nil uses default rendering. The grainOffset property is directly readable and writable. All state, including opaque internal properties, can be persisted by encoding the value using Codable.

## Topics

### Creating a render state

- [init(grainOffset:)](pencilkit/pkstroke-swift.struct/renderstate-swift.struct/init(grainoffset:).md)

### Getting the render state

- [grainOffset](pencilkit/pkstroke-swift.struct/renderstate-swift.struct/grainoffset.md)

### Using reference types

- [PKStrokeRenderState](pencilkit/pkstrokerenderstate.md)

### Initializers

- [init(_:)](pencilkit/pkstroke-swift.struct/renderstate-swift.struct/init(_:).md)

### Instance Methods

- [asObjCRenderState()](pencilkit/pkstroke-swift.struct/renderstate-swift.struct/asobjcrenderstate().md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Configuring rendering

- [renderGroupID](pencilkit/pkstroke-swift.struct/rendergroupid.md)
- [renderState](pencilkit/pkstroke-swift.struct/renderstate-swift.property.md)
