One Logo Pool Ball
Foundation · IOS API REFERENCE

AttributeScope

protocol · iOS 15.0+ · SDK 27.1

protocol AttributeScope : DecodingConfigurationProviding, EncodingConfigurationProviding, SendableMetatype

A type that organizes attributes into a grouping, and supports dynamic member lookup and serialization of attribute keys. Attribute owners — typically frameworks — define attributes with ``AttributedStringKey`` types. To allow access to attributes with dynamic member lookup, owners create one or more structures that conform to ``AttributeScope``. The scopes provide short names for their attributes that map to the ``AttributedStringKey`` type. The following example shows how to do this: ```swift struct TextStyleAttributes : AttributeScope { let foregroundColor : ForegroundColorAttribute // ForegroundColorAttribute.Value == Color let backgroundColor : BackgroundColorAttribute // BackgroundColorAttribute.Value == Color let underlineStyle : UnderlineStyleAttribute // UnderlineStyleAttribute.Value == UnderlineStyle // etc. } ``` This allows callers to use a syntax like `myAttributedString.foregroundColor = .red`.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

AttributeScope.encodingConfiguration

Static protocol requirements cannot be called through an instance.

AttributeScope.decodingConfiguration

Static protocol requirements cannot be called through an instance.

AttributeScope.attributeKeys

Static protocol requirements cannot be called through an instance.

All Foundation types →