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