<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/LayerRenderer/Drawable/View/TextureMap-swift.struct/sliceIndex",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Compositor Services",
      "CompositorServices"
    ],
    "preciseIdentifier" : "c:@F@cp_view_texture_map_get_slice_index"
  },
  "title" : "sliceIndex"
}
-->

# sliceIndex

The index of the view’s texture in an array-based texture type.

```
var sliceIndex: Int { get }
```

## Discussion

Use the returned index to retrieve the view’s texture when the texture type is
<doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2DArray>.
When configuring your render pass descriptor, specify the index in the
<doc://com.apple.documentation/documentation/Metal/MTLRenderPassAttachmentDescriptor/slice>
property of the descriptor’s color and depth attachments.

If you don’t use array-based textures for drawing, fetch the index using
[`textureIndex`](/documentation/CompositorServices/LayerRenderer/Drawable/View/TextureMap-swift.struct/textureIndex) instead.

---

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)