Skip to content

Instance SubscriptFoundationEssentials

subscript(dynamicMember:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Returns a modified attribute container as part of building a chain of attributes.
subscript<K>(dynamicMember keyPath: KeyPath<AttributeDynamicLookup, K>) -> AttributeContainer.Builder<K> where K : AttributedStringKey { get }

Overview

This method returns an AttributeContainer.Builder, which allows you to chain multiple attributes in a single call, like this:

// An attribute container with the link and backgroundColor attributes.
let myContainer = AttributeContainer().link(myURL).backgroundColor(.yellow)