---
title: "lineFragmentRange(for:inContainerAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextselectiondatasource/linefragmentrange(for:incontainerat:)"
---

# lineFragmentRange(for:inContainerAt:)

Returns the range of the line fragment that contains the point you specify.

## Declaration

```swift
func lineFragmentRange(for point: CGPoint, inContainerAt location: any NSTextLocation) -> NSTextRange?
```

## Parameters

- `point`: The starting point that contains the line fragment, in the coordinate system of location.
- `location`: The location of the line fragment.

## Return Value

Return Value An NSTextRange that describes the location of the line fragment, or nil if the range isn’t found.

## See Also

### Finding specific content in the selection

- [location(_:offsetBy:)](appkit/nstextselectiondatasource/location(_:offsetby:).md)
- [offset(from:to:)](appkit/nstextselectiondatasource/offset(from:to:).md)
- [textRange(for:enclosing:)](appkit/nstextselectiondatasource/textrange(for:enclosing:).md)
