<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKMutableTexture",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKMutableTexture"
  },
  "title" : "SKMutableTexture"
}
-->

# SKMutableTexture

A texture whose contents can be dynamically updated.

```
class SKMutableTexture
```

## Overview

Normally, SpriteKit textures ([`SKTexture`](/documentation/SpriteKit/SKTexture) objects) are static, meaning that once created, their contents cannot be changed. This is important because a static image can be more efficiently managed inside the graphics hardware. However, sometimes you need to be able to update the contents of a texture dynamically. In this case, you should use a mutable texture. Because there is a performance penalty for updating the texture’s contents, consider other options first. For example, you can render a texture in hardware using the [`texture(from:)`](/documentation/SpriteKit/SKView/texture(from:)) method and a node tree.

To use this class, create a mutable texture using either one of its creation methods or those of its superclass. Then, when you need to update the mutable texture object’s contents, call the [`modifyPixelData(_:)`](/documentation/SpriteKit/SKMutableTexture/modifyPixelData(_:)) method. Your block is called with the location of the texture in memory. Your block should update this texture and then return.

## Topics

### Creating an Empty Mutable Texture

[`+  mutableTextureWithSize:`](/documentation/SpriteKit/SKMutableTexture/mutableTextureWithSize:)

Creates an empty texture with a specific size.

[`-  initWithSize:pixelFormat:`](/documentation/SpriteKit/SKMutableTexture/init(size:pixelFormat:))

Initializes an empty texture with a specific size and format.

[`-  initWithSize:`](/documentation/SpriteKit/SKMutableTexture/init(size:))

Initializes an empty texture with a specific size.

### Modifying a Mutable Texture’s Contents

[`-  modifyPixelDataWithBlock:`](/documentation/SpriteKit/SKMutableTexture/modifyPixelData(_:))

Modifies the contents of a mutable texture.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`SKTexture`](/documentation/SpriteKit/SKTexture)

---

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)