focusScope(_:)
Creates a focus scope that SwiftUI uses to limit default focus preferences.
Declaration
nonisolated func focusScope(_ namespace: Namespace.ID) -> some View
Parameters
- namespace:
A namespace identifier that SwiftUI can use to scope default focus preferences.
Return Value
A view that sets the namespace of descendants for default focus.
Discussion
The returned view gets associated with the provided namespace. Pass this namespace to prefersDefaultFocus(_:in:) and the resetFocus function.