---
title: "focusedValue(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/focusedvalue(_:)"
---

# focusedValue(_:)

Sets the focused value for the given object type.

## Declaration

```swift
nonisolated func focusedValue<T>(_ object: T?) -> some View where T : AnyObject, T : Observable

```

## Mentioned in

Building and customizing the menu bar with SwiftUI

## Discussion

Discussion important: This initializer only accepts objects conforming to the Observable protocol. For reading environment objects that conform to ObservableObject, use focusedObject(_:), instead. To read this value, use the FocusedValue property wrapper.

## See Also

### Exposing value types to focused views

- [focusedValue(_:_:)](swiftui/view/focusedvalue(_:_:).md)
- [focusedSceneValue(_:)](swiftui/view/focusedscenevalue(_:).md)
- [focusedSceneValue(_:_:)](swiftui/view/focusedscenevalue(_:_:).md)
- [FocusedValues](swiftui/focusedvalues.md)
