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

# isValid(within:)

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

## Declaration

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

## Parameters

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

## Return Value

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