<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/focusedValue(_:_:)-8079u",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE12focusedValueyQrs15WritableKeyPathCyAA13FocusedValuesVqd__SgG_qd__tlF"
  },
  "title" : "focusedValue(_:_:)"
}
-->

# focusedValue(_:_:)

Modifies this view by injecting a value that you provide for use by
other views whose state depends on the focused view hierarchy.

```
nonisolated func focusedValue<Value>(_ keyPath: WritableKeyPath<FocusedValues, Value?>, _ value: Value) -> some View
```

## Parameters

`keyPath`

The key path to associate `value` with when adding
it to the existing table of exported focus values.

`value`

The focus value to export.

## Return Value

A modified representation of this view.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)