---
title: "subdata(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/data/subdata(in:)"
---

# subdata(in:)

Returns a new copy of the data in a specified range.

## Declaration

```swift
func subdata(in range: Range<Data.Index>) -> Data
```

## Parameters

- `range`: The range to copy.
