Contents

AttributedTextSelection.Attributes

A sequence of all attribute values a selection has in a certain text.

Declaration

struct Attributes<Text>

Overview

The values of a selection are the attribute values of each run that is fully or partially selected, or the typing attributes in the case the selection is an insertion point.

By default, the sequence contains the attribute container for every run or the typing attributes. Use the AttributedTextSelection.Attributes’ subscript to obtain only the values for a single attribute:

selection.attributes(in: text)[\.foregroundColor].contains(.red)

Topics

Subscripts