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

# focusScope(_:)

Creates a focus scope that SwiftUI uses to limit default focus preferences.

## Declaration

```swift
nonisolated func focusScope(_ namespace: Namespace.ID) -> some View

```

## Parameters

- `namespace`: A namespace identifier that SwiftUI can use to scope default focus preferences.

## Return Value

Return Value A view that sets the namespace of descendants for default focus.

## Discussion

Discussion The returned view gets associated with the provided namespace. Pass this namespace to prefersDefaultFocus(_:in:) and the resetFocus function.

## See Also

### Setting focus scope

- [focusSection()](swiftui/view/focussection().md)
