---
title: "newTexture(data:options:)"
framework: metalkit
role: symbol
role_heading: Instance Method
path: "metalkit/mtktextureloader/newtexture(data:options:)"
---

# newTexture(data:options:)

Synchronously creates a new Metal texture from an in-memory representation of the texture’s data.

## Declaration

```swift
func newTexture(data: Data, options: [MTKTextureLoader.Option : Any]? = nil) throws -> any MTLTexture
```

## Parameters

- `data`: The doc://com.apple.documentation/documentation/Foundation/NSData object containing image data.
- `options`: A dictionary describing any additional texture loading steps. See Texture Loading Options.

## Return Value

Return Value A fully loaded and initialized Metal texture, or nil if an error occurred.

## See Also

### Loading Textures from In-Memory Data Representations

- [newTexture(data:options:completionHandler:)](metalkit/mtktextureloader/newtexture(data:options:completionhandler:).md)
