Contents

replace(using:options:)

Asynchronously replaces the texture with a Core Graphics image.

Declaration

@MainActor @preconcurrency func replace(using cgImage: CGImage, options: TextureResource.CreateOptions) async throws

Parameters

  • cgImage:

    The source image.

  • options:

    Options that specify the type of texture to create. To preserve TextureResource usage, specify the same semantic.

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.

See Also

Modifying the texture