Contents

constrain(_:)

Applies all value constraints to a given attributed string.

Declaration

func constrain(_ string: inout AttributedString)

Discussion

Modifies the given string by applying all AttributedTextValueConstraints that are part of this definition to each run of the string.

Use this function to test your AttributedTextFormattingDefinition, or to ensure your constraints are applied before passing content to API that cannot itself apply the definition.