Skip to content

Instance MethodFoundationEssentials

index(_:offsetByCharacters:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Returns the position of the character offset a given distance, measured in characters, from a given string index.
func index(_ i: AttributedString.Index, offsetByCharacters distance: Int) -> AttributedString.Index

Parameters

i

The index of a position in the string.

distance

The number of charcters to advance by.