Contents

AttributeScopes

Collections of attributes that system frameworks define.

Declaration

@frozen enum AttributeScopes

Overview

Attribute scopes define groups of attributes appropriate for use with attributed strings in a certain domain. Attribute definitions contain a name, value type, and encode/decode methods to support serialization.

For example, the AttributeScopes.FoundationAttributes scope provides an attribute type for a link to a URL, AttributeScopes.FoundationAttributes.LinkAttribute, along with a property to access this type, link. Because AttributeScopes.FoundationAttributes implements AttributeDynamicLookup, you can access the link attribute by name, as this example shows:

var attrStr = AttributedString("Example site")
attrStr.link = URL(string: "http://example.com")

Topics

Foundation-Defined Attributes

SwiftUI-Defined Attributes

UIKit-Defined Attributes

AppKit-Defined Attributes

Translation-Defined Attributes

Structures

Instance Properties

See Also

Using Defined Attributes