Skip to content

Instance Subscript

subscript(_:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Returns an attribute value that corresponds to an attributed string key.
@preconcurrency subscript<K>(_: K.Type) -> K.Value? where K : AttributedStringKey, K.Value : Sendable { get set }

Overview

This subscript returns nil unless the specified attribute exists, and is present and identical for the entire attributed string or substring. To find portions of an attributed string with consistent attributes, use the runs property.

Default Implementations

AttributedStringProtocol Implementations