---
title: "focusGroups(for:)"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uifocusdebugger/focusgroups(for:)"
---

# focusGroups(for:)

Returns the focus group hierarchy for the specified environment object.

## Declaration

```swift
class func focusGroups(for environment: any UIFocusEnvironment) -> any UIFocusDebuggerOutput
```

## Parameters

- `environment`: The object you want to generate a focus group hierarchy for. Specify the focus system, view, view controller, or window whose state you want. You can also specify any other object that adopts the doc://com.apple.uikit/documentation/UIKit/UIFocusEnvironment protocol.

## Return Value

Return Value An object the focus debugger uses to store the results that it formats for display.

## Discussion

Discussion Call this method from the lldb debugger using the following command. In the example, obj corresponds to an object that adopts the UIFocusEnvironment protocol. The method returns the full hierarchy of focus groups for the focus environment object provided. note: This method replaces the checkFocusGroup(for:) method, which is functionally equivalent.

## See Also

### Getting focus information

- [status()](uikit/uifocusdebugger/status().md)
- [checkFocusability(for:)](uikit/uifocusdebugger/checkfocusability(for:).md)
- [preferredFocusEnvironments(for:)](uikit/uifocusdebugger/preferredfocusenvironments(for:).md)
- [simulateFocusUpdateRequest(from:)](uikit/uifocusdebugger/simulatefocusupdaterequest(from:).md)
- [UIFocusDebuggerOutput](uikit/uifocusdebuggeroutput.md)
