<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AttributeScopes",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation15AttributeScopesO"
  },
  "title" : "AttributeScopes"
}
-->

# AttributeScopes

Collections of attributes that system frameworks define.

```
@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`](/documentation/Foundation/AttributeScopes/FoundationAttributes) scope provides an attribute type for a link to a URL, [`AttributeScopes.FoundationAttributes.LinkAttribute`](/documentation/Foundation/AttributeScopes/FoundationAttributes/LinkAttribute), along with a property to access this type, [`link`](/documentation/Foundation/AttributeScopes/FoundationAttributes/link). Because [`AttributeScopes.FoundationAttributes`](/documentation/Foundation/AttributeScopes/FoundationAttributes) implements [`AttributeDynamicLookup`](/documentation/Foundation/AttributeDynamicLookup), you can access the link attribute by name, as this example shows:

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

## Topics

### Foundation-Defined Attributes

[`foundation`](/documentation/Foundation/AttributeScopes/foundation)

A property for accessing the attribute scopes that Foundation defines.

[`AttributeScopes.FoundationAttributes`](/documentation/Foundation/AttributeScopes/FoundationAttributes)

Attribute scopes that Foundation defines.

### SwiftUI-Defined Attributes

[`swiftUI`](/documentation/Foundation/AttributeScopes/swiftUI)

A property for accessing the attribute scopes that SwiftUI defines.

[`AttributeScopes.SwiftUIAttributes`](/documentation/Foundation/AttributeScopes/SwiftUIAttributes)

Attribute scopes that SwiftUI defines.

### UIKit-Defined Attributes

[`uiKit`](/documentation/Foundation/AttributeScopes/uiKit)

A property for accessing the attribute scopes that UIKit defines.

[`AttributeScopes.UIKitAttributes`](/documentation/Foundation/AttributeScopes/UIKitAttributes)

Attribute scopes that UIKit defines.

### AppKit-Defined Attributes

[`appKit`](/documentation/Foundation/AttributeScopes/appKit)

A property for accessing the attribute scopes that AppKit defines.

[`AttributeScopes.AppKitAttributes`](/documentation/Foundation/AttributeScopes/AppKitAttributes)

Attribute scopes that AppKit defines.

### Translation-Defined Attributes

[`translation`](/documentation/Foundation/AttributeScopes/translation)

Provides access to translation-related attributes.

[`AttributeScopes.TranslationAttributes`](/documentation/Foundation/AttributeScopes/TranslationAttributes)

A scope that defines translation-specific properties on attributed strings.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)