<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLTexture/makeTextureView(pixelFormat:textureType:levels:slices:swizzle:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So10MTLTextureP5MetalE15makeTextureView11pixelFormat11textureType6levels6slices7swizzleSoAA_pSgSo08MTLPixelG0V_So0aI0VSnySiGAOSo0A15SwizzleChannelsatF"
  },
  "title" : "makeTextureView(pixelFormat:textureType:levels:slices:swizzle:)"
}
-->

# makeTextureView(pixelFormat:textureType:levels:slices:swizzle:)

Creates a new view of the texture, reinterpreting a subset of its data using a different type, pixel format, and swizzle pattern.

```
func makeTextureView(pixelFormat: MTLPixelFormat, textureType: MTLTextureType, levels levelRange: Range<Int>, slices sliceRange: Range<Int>, swizzle: MTLTextureSwizzleChannels) -> (any MTLTexture)?
```

## Parameters

`pixelFormat`

A new pixel format, which needs to be compatible with the original pixel format.

`textureType`

A new texture type.

`levelRange`

A new base level range that restricts which mipmap levels are visible in the new texture.

`sliceRange`

A new base slice range that restricts which array slices are visible in the new texture.

`swizzle`

The swizzle pattern the GPU uses to reorder the data when sampling or reading the texture.

## Discussion

For more information on texture views, see [`makeTextureView(pixelFormat:textureType:levels:slices:)`](/documentation/Metal/MTLTexture/makeTextureView(pixelFormat:textureType:levels:slices:))

The swizzle pattern of the view is combined with that of the parent texture to generate the final swizzle pattern. For example: An `[R,G,A,B]` swizzle of a texture with a `[R,1,1,G]` swizzle pattern is `[R,1,G,1]`.

---

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)