<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFocusEnvironment",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIFocusEnvironment"
  },
  "title" : "UIFocusEnvironment"
}
-->

# UIFocusEnvironment

A set of methods that define the focus behavior for a branch of the view hierarchy.

```
@MainActor protocol UIFocusEnvironment : NSObjectProtocol
```

## Overview

The [`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment) protocol provides a common interface for specifying and reacting to focus behavior throughout your app. Classes in UIKit that conform to this protocol include [`UIView`](/documentation/UIKit/UIView), [`UIViewController`](/documentation/UIKit/UIViewController), [`UIWindow`](/documentation/UIKit/UIWindow), and [`UIPresentationController`](/documentation/UIKit/UIPresentationController) — in other words, classes that are either directly or indirectly in control of views on the screen.

## Topics

### Requesting focus update

[`-  setNeedsFocusUpdate`](/documentation/UIKit/UIFocusEnvironment/setNeedsFocusUpdate())

Submits a request to the focus engine for a focus update in this environment.

[`-  updateFocusIfNeeded`](/documentation/UIKit/UIFocusEnvironment/updateFocusIfNeeded())

Tells the focus engine to force a focus update immediately.

### Validating focus movements

[`-  shouldUpdateFocusInContext:`](/documentation/UIKit/UIFocusEnvironment/shouldUpdateFocus(in:))

Returns a Boolean value indicating whether the focus engine should allow the focus update described by the specified context to occur.

### Responding to focus updates

[`-  didUpdateFocusInContext:withAnimationCoordinator:`](/documentation/UIKit/UIFocusEnvironment/didUpdateFocus(in:with:))

Called immediately after the system updates the focus to a new view.

### Controlling user-generated focus movements

[`preferredFocusEnvironments`](/documentation/UIKit/UIFocusEnvironment/preferredFocusEnvironments)

An array of focus environments, ordered by priority, to which this environment prefers focus to be directed during a focus update.

[`preferredFocusedView`](/documentation/UIKit/UIFocusEnvironment/preferredFocusedView)

Specifies the view that should be focused if this environment is focused.

### Getting the sound to play during updates

[Using custom sounds for focus movement](/documentation/UIKit/using-custom-sounds-for-focus-movement)

Customize the sounds users hear when focus moves.

[`-  soundIdentifierForFocusUpdateInContext:`](/documentation/UIKit/UIFocusEnvironment/soundIdentifierForFocusUpdate(in:))

Asks the delegate for the identifier of the sound to play when the object gains focus.

[`UIFocusSoundIdentifier`](/documentation/UIKit/UIFocusSoundIdentifier)

An identifier for a focus-related sound.

### Checking the ancestry of the environment

[`parentFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment/parentFocusEnvironment)

The parent focus environment for this environment.

[`focusItemContainer`](/documentation/UIKit/UIFocusEnvironment/focusItemContainer)

The container for the child focus items in this focus environment.

### Identifying the focus group

[`focusGroupIdentifier`](/documentation/UIKit/UIFocusEnvironment/focusGroupIdentifier)

The identifier of the focus group that the environment belongs to.

## Relationships

### Conforming Types

[`UIImagePickerController`](/documentation/UIKit/UIImagePickerController)

[`UIToolbar`](/documentation/UIKit/UIToolbar)

[`UICollectionViewListCell`](/documentation/UIKit/UICollectionViewListCell)

[`UITextField`](/documentation/UIKit/UITextField)

[`UIScrollView`](/documentation/UIKit/UIScrollView)

[`UIPasteControl`](/documentation/UIKit/UIPasteControl)

[`UIView`](/documentation/UIKit/UIView)

[`UISearchTextField`](/documentation/UIKit/UISearchTextField)

[`UIDocumentBrowserViewController`](/documentation/UIKit/UIDocumentBrowserViewController)

[`UICollectionReusableView`](/documentation/UIKit/UICollectionReusableView)

[`UIPresentationController`](/documentation/UIKit/UIPresentationController)

[`UICollectionViewCell`](/documentation/UIKit/UICollectionViewCell)

[`UIInputView`](/documentation/UIKit/UIInputView)

[`UIDocumentPickerExtensionViewController`](/documentation/UIKit/UIDocumentPickerExtensionViewController)

[`UITabBar`](/documentation/UIKit/UITabBar)

[`UIPopoverBackgroundView`](/documentation/UIKit/UIPopoverBackgroundView)

[`UIColorPickerViewController`](/documentation/UIKit/UIColorPickerViewController)

[`UITableViewController`](/documentation/UIKit/UITableViewController)

[`UIPageControl`](/documentation/UIKit/UIPageControl)

[`UIProgressView`](/documentation/UIKit/UIProgressView)

[`UIPickerView`](/documentation/UIKit/UIPickerView)

[`UIVisualEffectView`](/documentation/UIKit/UIVisualEffectView)

[`UIEventAttributionView`](/documentation/UIKit/UIEventAttributionView)

[`UINavigationBar`](/documentation/UIKit/UINavigationBar)

[`UIStandardTextCursorView`](/documentation/UIKit/UIStandardTextCursorView)

[`UIDatePicker`](/documentation/UIKit/UIDatePicker)

[`UIFontPickerViewController`](/documentation/UIKit/UIFontPickerViewController)

[`UIWebView`](/documentation/UIKit/UIWebView)

[`UINavigationController`](/documentation/UIKit/UINavigationController)

[`UISwitch`](/documentation/UIKit/UISwitch)

[`UICalendarView`](/documentation/UIKit/UICalendarView)

[`UIAlertController`](/documentation/UIKit/UIAlertController)

[`UISearchContainerViewController`](/documentation/UIKit/UISearchContainerViewController)

[`UIContentUnavailableView`](/documentation/UIKit/UIContentUnavailableView)

[`UITableView`](/documentation/UIKit/UITableView)

[`UISplitViewController`](/documentation/UIKit/UISplitViewController)

[`UIActionSheet`](/documentation/UIKit/UIActionSheet)

[`UITextFormattingViewController`](/documentation/UIKit/UITextFormattingViewController)

[`UIViewController`](/documentation/UIKit/UIViewController)

[`UIStackView`](/documentation/UIKit/UIStackView)

[`UIImageView`](/documentation/UIKit/UIImageView)

[`UIControl`](/documentation/UIKit/UIControl)

[`UIReferenceLibraryViewController`](/documentation/UIKit/UIReferenceLibraryViewController)

[`UISearchController`](/documentation/UIKit/UISearchController)

[`UIBackgroundExtensionView`](/documentation/UIKit/UIBackgroundExtensionView)

[`UICollectionViewController`](/documentation/UIKit/UICollectionViewController)

[`UISlider`](/documentation/UIKit/UISlider)

[`UITableViewHeaderFooterView`](/documentation/UIKit/UITableViewHeaderFooterView)

[`UITableViewCell`](/documentation/UIKit/UITableViewCell)

[`UICollectionView`](/documentation/UIKit/UICollectionView)

[`UIListContentView`](/documentation/UIKit/UIListContentView)

[`UIStepper`](/documentation/UIKit/UIStepper)

[`UIColorWell`](/documentation/UIKit/UIColorWell)

[`UIPopoverPresentationController`](/documentation/UIKit/UIPopoverPresentationController)

[`UILabel`](/documentation/UIKit/UILabel)

[`UIRefreshControl`](/documentation/UIKit/UIRefreshControl)

[`UIActivityIndicatorView`](/documentation/UIKit/UIActivityIndicatorView)

[`UISegmentedControl`](/documentation/UIKit/UISegmentedControl)

[`UIWindow`](/documentation/UIKit/UIWindow)

[`UIDocumentViewController`](/documentation/UIKit/UIDocumentViewController)

[`UIDocumentPickerViewController`](/documentation/UIKit/UIDocumentPickerViewController)

[`UIButton`](/documentation/UIKit/UIButton)

[`UIInputViewController`](/documentation/UIKit/UIInputViewController)

[`UITabBarController`](/documentation/UIKit/UITabBarController)

[`UIPageViewController`](/documentation/UIKit/UIPageViewController)

[`UITextView`](/documentation/UIKit/UITextView)

[`UIActivityViewController`](/documentation/UIKit/UIActivityViewController)

[`UISheetPresentationController`](/documentation/UIKit/UISheetPresentationController)

[`UIAlertView`](/documentation/UIKit/UIAlertView)

[`UISearchBar`](/documentation/UIKit/UISearchBar)

[`UICloudSharingController`](/documentation/UIKit/UICloudSharingController)

[`UIVideoEditorController`](/documentation/UIKit/UIVideoEditorController)

[`UIDocumentMenuViewController`](/documentation/UIKit/UIDocumentMenuViewController)

### Inherited By

[`UIFocusItem`](/documentation/UIKit/UIFocusItem)

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)