subscript<T>(T.Type) -> T
Overview 概要
This type allows attribute owners to add extensions that enable dynamic member lookup access to attributes. Supporting types — including Attributed
, Attributed
, and Attribute
— gain dynamic lookup support by extending this type.
この型は、属性所有者に拡張いくつかを追加させます、それらは属性への動的メンバ検索アクセスを可能にするものです。サポートする型 — Attributed
、Attributed
、そしてAttribute
を含む — は、動的検索サポートをこの型を拡張することによって手に入れます。
You can enable dynamic member lookup for your own Attributed
attributes by defining them as implementations, collecting them into an Attribute
and extending Attribute
, like in the following example:
あなたは、動的メンバアクセスをあなた自身のAttributed
属性それらに対してそれらを実装として定義することによって有効にできます、それらをAttribute
へと収集してそしてAttribute
を拡張して、以下の例でのように:
public extension AttributeDynamicLookup {
subscript<T: AttributedStringKey>(dynamicMember keyPath: KeyPath<AttributeScopes.MyFrameworkAttributes, T>) -> T {
return self[T.self]
}
}