---
title: NSAttributedString.TextHighlightStyle
framework: foundation
role: symbol
role_heading: Structure
path: foundation/nsattributedstring/texthighlightstyle
---

# NSAttributedString.TextHighlightStyle

Constants that specify the type of highlight to apply to text.

## Declaration

```swift
struct TextHighlightStyle
```

## Overview

Overview Use an NSAttributedString.TextHighlightStyle structure as the value of the textHighlightStyle attribute. That attribute applies a highlight to the text to emphasize it. The highlight contributes a background color and a contrasting foreground color to the text.

## Topics

### Getting the highlight styles

- [default](foundation/nsattributedstring/texthighlightstyle/default.md)

### Creating a highlight style

- [init(_:)](foundation/nsattributedstring/texthighlightstyle/init(_:).md)
- [init(rawValue:)](foundation/nsattributedstring/texthighlightstyle/init(rawvalue:).md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Getting text content attributes

- [NSAttributedString.Key](foundation/nsattributedstring/key.md)
- [NSAttributedString.TextHighlightColorScheme](foundation/nsattributedstring/texthighlightcolorscheme.md)
- [NSAttributedString.TextEffectStyle](foundation/nsattributedstring/texteffectstyle.md)
- [NSAttributedString.SpellingState](foundation/nsattributedstring/spellingstate.md)
- [NSUnderlineStyle](uikit/nsunderlinestyle.md)
- [NSWritingDirectionFormatType](uikit/nswritingdirectionformattype.md)
