Skip to content

Instance MethodSwift

isValid(within:)

iOS 26.0+ iPadOS 26.0+ Mac Catalyst 26.0+ macOS 26.0+ tvOS 26.0+ visionOS 26.0+ watchOS 26.0+
Indicates whether the range is valid for use with the provided discontiguous attributed string.
func isValid(within text: DiscontiguousAttributedSubstring) -> Bool

Parameters

text

A discontiguous attributed string used to validate the range.

Return Value

true when the range is valid for use with the provided discontiguous attributed string; otherwise, false. A range is valid if its lower and upper bounds are each either valid in the discontiguous attributed string or equivalent to the string’s endIndex.