---
title: "init(location:length:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsrange-swift.typealias/init(location:length:)"
---

# init(location:length:)

Creates a range with the given location and length.

## Declaration

```swift
init(location: Int, length: Int)
```

## Parameters

- `location`: The index of the first member of the range.
- `length`: The number of items in the range.

## See Also

### Creating a range

- [init()](foundation/nsrange-swift.typealias/init().md)
