---
title: AVTextStyleRule
framework: avfoundation
role: symbol
role_heading: Class
path: avfoundation/avtextstylerule
---

# AVTextStyleRule

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

## Declaration

```swift
class AVTextStyleRule
```

## Overview

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:)](avfoundation/avtextstylerule/textstylerules(frompropertylist:).md)
- [init(textMarkupAttributes:)](avfoundation/avtextstylerule/init(textmarkupattributes:).md)
- [init(textMarkupAttributes:textSelector:)](avfoundation/avtextstylerule/init(textmarkupattributes:textselector:).md)

### Accessing the style attributes

- [textMarkupAttributes](avfoundation/avtextstylerule/textmarkupattributes.md)
- [textSelector](avfoundation/avtextstylerule/textselector.md)

### Exporting the style rules

- [propertyList(for:)](avfoundation/avtextstylerule/propertylist(for:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Accessing text style rules

- [textStyleRules](avfoundation/avplayeritem/textstylerules.md)
