<!--
{
  "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/init(textMarkupAttributes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVTextStyleRule(im)initWithTextMarkupAttributes:"
  },
  "title" : "init(textMarkupAttributes:)"
}
-->

# init(textMarkupAttributes:)

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

```
convenience init?(textMarkupAttributes: [String : Any] = [:])
```

## Parameters

`textMarkupAttributes`

A dictionary of style attributes. For a list of supported keys and values that you can include in this dictionary, see `CMTextMarkup.h`.

## Return Value

A text style rule object initialized with the specified attributes.

## Discussion

This method sets the [`textSelector`](/documentation/AVFoundation/AVTextStyleRule/textSelector) property of the style object to `nil`, which causes the rules to be applied to all of the text in the media item.

---

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)