---
title: "subscript(_:)"
framework: swiftui
role: symbol
role_heading: Instance Subscript
path: "swiftui/focusedvalues/subscript(_:)"
---

# subscript(_:)

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

## Declaration

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

## Overview

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? }
