Instance MethodFoundationEssentials
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 index is valid for use with the provided discontiguous attributed string.
func isValid(within text: DiscontiguousAttributedSubstring) -> Bool
Parameters
textA discontiguous attributed string used to validate the index.
Return Value
true when the index is valid for use with the provided discontiguous attributed string; otherwise, false. An index is valid if it is both within the bounds of the discontiguous attributed string and was produced from the provided string without any intermediate mutations.