---
title: "isValid(within:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/rangeset/isvalid(within:)-6u17e"
---

# isValid(within:)

Indicates whether the range set is valid for use with the provided attributed string.

## Declaration

```swift
func isValid(within text: some AttributedStringProtocol) -> Bool
```

## Parameters

- `text`: An attributed string used to validate the range set.

## Return Value

Return Value true when the range set is valid for use with the provided attributed string; otherwise, false. A range set is valid if each of its ranges are valid in the attributed string.
