Contents

subscript(dynamicMember:)

Provides dynamic member lookup for translation attributes.

Declaration

subscript<T>(dynamicMember keyPath: KeyPath<AttributeScopes.TranslationAttributes, T>) -> T where T : AttributedStringKey { get }

Parameters

  • keyPath:

    A key path to a property in the TranslationAttributes scope.

Return Value

The attribute key type that can be used to get or set attribute values.

Overview

This subscript enables the convenient dot-syntax access to translation attributes on AttributedString:

var text = AttributedString("Product Name")
text.skipsTranslation = true