Skip to content

Instance SubscriptFoundationEssentials

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

Returns nil unless the specified attribute exists and is present and identical for the entire string or substring. Use runs to find portions with consistent attributes.