<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFocusDebugger/focusGroups(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIFocusDebugger(cm)focusGroupsForEnvironment:"
  },
  "title" : "focusGroups(for:)"
}
-->

# focusGroups(for:)

Returns the focus group hierarchy for the specified environment object.

```
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 [`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment) protocol.

## Return Value

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

## Discussion

Call this method from the `lldb` debugger using the following command. In the example, `obj` corresponds to an object that adopts the [`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment) protocol.

```objc
po [UIFocusDebugger focusGroupsForEnvironment:obj]
```

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.

---

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)