<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVTextStyleRule",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVTextStyleRule"
  },
  "title" : "AVTextStyleRule"
}
-->

# AVTextStyleRule

An object that represents the text styling rules to apply to a media item’s textual content.

```
class AVTextStyleRule
```

## Overview

You use text style objects to format subtitles, closed captions, and other text-related content of the item. The system applies these rules to all or part of the text of the media item.

## Topics

### Creating and initializing style rules

[`textStyleRules(fromPropertyList:)`](/documentation/AVFoundation/AVTextStyleRule/textStyleRules(fromPropertyList:))

Creates an array of text style rule objects from the specified property-list object.

[`textStyleRuleWithTextMarkupAttributes:`](/documentation/AVFoundation/AVTextStyleRule/textStyleRuleWithTextMarkupAttributes:)

Creates a new text style rule object using the style attributes in the specified dictionary.

[`textStyleRuleWithTextMarkupAttributes:textSelector:`](/documentation/AVFoundation/AVTextStyleRule/textStyleRuleWithTextMarkupAttributes:textSelector:)

Creates a new text style rule object using the specified style attributes and text range information.

[`init(textMarkupAttributes:)`](/documentation/AVFoundation/AVTextStyleRule/init(textMarkupAttributes:))

Creates a text style rule object with the specified style attributes.

[`init(textMarkupAttributes:textSelector:)`](/documentation/AVFoundation/AVTextStyleRule/init(textMarkupAttributes:textSelector:))

Creates a text style rule object with the specified style attributes and text range information.

### Accessing the style attributes

[`textMarkupAttributes`](/documentation/AVFoundation/AVTextStyleRule/textMarkupAttributes)

A dictionary of text style attributes to apply to the text.

[`textSelector`](/documentation/AVFoundation/AVTextStyleRule/textSelector)

A string that identifies the text to which the attributes should apply.

### Exporting the style rules

[`propertyList(for:)`](/documentation/AVFoundation/AVTextStyleRule/propertyList(for:))

Converts one or more text style rules into a serializable property list object.



---

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)