<!--
{
  "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/ObjectiveCConvertibleAttributedStringKey",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation40ObjectiveCConvertibleAttributedStringKeyP"
  },
  "title" : "ObjectiveCConvertibleAttributedStringKey"
}
-->

# ObjectiveCConvertibleAttributedStringKey

A protocol that defines Objective-C interoperability with an attribute key’s value type.

```
protocol ObjectiveCConvertibleAttributedStringKey : AttributedStringKey
```

## Overview

Conform to this protocol to allow your attributed string key to customize its Objective-C conversion behavior. This allows you to define an Objective-C value type and provide methods to convert to and from this type.

Attributed string keys that don’t conform to this protocol cast the value to <doc://com.apple.documentation/documentation/Swift/AnyObject> before converting to Objective-C. When converting from Objective-C, the value casts to the key’s [`Value`](/documentation/Foundation/AttributedStringKey/Value) type. In cases where Swift types bridge automatically to Objective-C types, like <doc://com.apple.documentation/documentation/Swift/String> to [`NSString`](/documentation/Foundation/NSString), this default behavior is adequate. But for unbridged value types, you need to conform to this protocol and provide the conversion methods.

## Topics

### Accessing the Objective-C Type

[`associatedtype ObjectiveCValue : NSObject`](/documentation/Foundation/ObjectiveCConvertibleAttributedStringKey/ObjectiveCValue)

The Objective-C type that corresponds to this key’s value type.

### Converting between Swift and Objective-C Types

[`static func objectiveCValue(for: Self.Value) throws -> Self.ObjectiveCValue`](/documentation/Foundation/ObjectiveCConvertibleAttributedStringKey/objectiveCValue(for:))

Returns an Objective-C typed value for a given value of this key’s type.

[`static func value(for: Self.ObjectiveCValue) throws -> Self.Value`](/documentation/Foundation/ObjectiveCConvertibleAttributedStringKey/value(for:))

Returns a value of this key’s type for a given Objective-C value.

## Relationships

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`AttributedStringKey`](/documentation/Foundation/AttributedStringKey)

### Conforming Types

[`AnnouncementPriorityAttribute`](/documentation/Foundation/AttributeScopes/AccessibilityAttributes/AnnouncementPriorityAttribute)

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

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

[`HeadingLevelAttribute`](/documentation/Foundation/AttributeScopes/AccessibilityAttributes/HeadingLevelAttribute)

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

[`TextualContextAttribute`](/documentation/Foundation/AttributeScopes/AccessibilityAttributes/TextualContextAttribute)

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

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

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

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

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

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

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

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

[`AdjustedPitchAttribute`](/documentation/Foundation/AttributeScopes/AccessibilityAttributes/AdjustedPitchAttribute)

---

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)