---
title: "setTextureView(texture:descriptor:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtltextureviewpool/settextureview(texture:descriptor:index:)"
---

# setTextureView(texture:descriptor:index:)

Creates a new lightweight texture view.

## Declaration

```swift
func setTextureView(texture: any MTLTexture, descriptor: MTLTextureViewDescriptor, index: Int) -> MTLResourceID
```

## Parameters

- `texture`: An doc://com.apple.metal/documentation/Metal/MTLTexture instance for which to create a new lightweight texture view.
- `descriptor`: A descriptor specifying properties of the texture view to create.
- `index`: An index of a slot in the texture pool into which this method writes the new texture view.

## Return Value

Return Value The MTLResourceID of a newly created texture view in this pool.

## Discussion

Discussion This method creates a lightweight texture view over a texture according to a descriptor you provide. It then associates the texture view with a slot in this texture view pool at the index you specify.
