Generic Subscript

subscript(dynamicMember:)

Returns an attribute value that a key path indicates. ある属性値を返します、それはあるキーパスが指し示すものです。

Declaration 宣言

subscript<K>(dynamicMember keyPath: KeyPath<AttributeDynamicLookup, K>) -> K.Value? where K : AttributedStringKey { get set }

Discussion 議論

This subscript returns nil unless the specified attribute exists, and is present and identical for the entire attributed string or substring. To find portions of the string with consistent attributes, use the runs property. この添え字(subscript)は、指定された属性が存在しないならばnilを返します、そして属性付き文字列または下位文字列の全体のために存在してそして同一的です。文字列の一部分を持続的属性で見つけるには、runsプロパティを使ってください。

Getting or setting stringwide attributes with this subscript has O(n) behavior in the worst case, where n is the number of runs. 文字列全体にわたる属性をこの添え字で取得および設定することは、O(n)挙動を最悪の場合には持ちます、そこでnはrunsの数です。

Relationships 関係

From Protocol 由来プロトコル

See Also 参照

Accessing Whole-Substring Attributes 下位文字列属性全体にアクセスする