Contents

subscript(_:)

Reads and writes values associated with a given focused value key.

Declaration

subscript<Key>(key: Key.Type) -> Key.Value? where Key : FocusedValueKey { get set }

Overview

Use this subscript to get or set a focused value for a custom FocusedValueKey. In most cases, you’ll use the Entry macro to create focused value properties, which automatically generates the appropriate key and uses this subscript internally:

extension FocusedValues {
    @Entry var myCustomValue: MyType?
}