---
title: "replaceAsync(withImage:options:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/textureresource/replaceasync(withimage:options:)"
---

# replaceAsync(withImage:options:)

Asynchronously replaces the texture with a Core Graphics image.

## Declaration

```swift
@MainActor @preconcurrency func replaceAsync(withImage cgImage: CGImage, options: TextureResource.CreateOptions) -> LoadRequest<TextureResource>
```

## Parameters

- `cgImage`: The source image.
- `options`: Options that specify the type of texture to create. To preserve TextureResource usage, specify the same semantic.

## Discussion

Discussion Don’t use this method for updates at frame-rate frequency. For frequent texture changes, see replace(withDrawables:). To ensure consistent usage of this texture resource, pass the same semantic in options that you use to create the resource. note: The contents of a modified texture resource don’t sync between network clients.

## See Also

### Deprecated

- [generate(from:withName:options:)](realitykit/textureresource/generate(from:withname:options:).md)
- [generateAsync(from:withName:options:)](realitykit/textureresource/generateasync(from:withname:options:).md)
- [generate(from:named:options:)](realitykit/textureresource/generate(from:named:options:).md)
- [loadAsync(contentsOf:withName:options:)](realitykit/textureresource/loadasync(contentsof:withname:options:).md)
