Skip to content

Instance MethodFoundationEssentials

index(_:offsetByUnicodeScalars:)

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

Parameters

i

The index of a position in the string.

distance

The number of Unicode scalars to advance by.