---
title: "slice(data:bytesPerRow:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/textureresource/contents/slice/slice(data:bytesperrow:)"
---

# slice(data:bytesPerRow:)

Specifies a single mipmap level slice of a texture resource with pixel data that RealityKit copies from a byte buffer.

## Declaration

```swift
static func slice(data: Data, bytesPerRow: Int) -> TextureResource.Contents.Slice
```

## Parameters

- `data`: The source buffer.
- `bytesPerRow`: The stride in bytes between rows of texture data that RealityKit stores in the source buffer. The value needs to be a multiple of the destination texture’s pixel size, in bytes.

## See Also

### Creating a texture slice

- [slice(unsafeBuffer:offset:size:bytesPerRow:)](realitykit/textureresource/contents/slice/slice(unsafebuffer:offset:size:bytesperrow:).md)
