<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLTextureViewPool/setTextureView(texture:descriptor:index:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLTextureViewPool(im)setTextureView:descriptor:atIndex:"
  },
  "title" : "setTextureView(texture:descriptor:index:)"
}
-->

# setTextureView(texture:descriptor:index:)

Creates a new lightweight texture view.

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

## Parameters

`texture`

An [`MTLTexture`](/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

The [`MTLResourceID`](/documentation/Metal/MTLResourceID) of a newly created texture view in this pool.

## 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.

---

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)