---
title: "didUpdateFocus(in:with:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uifocusenvironment/didupdatefocus(in:with:)"
---

# didUpdateFocus(in:with:)

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

## Declaration

```swift
func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator)
```

## Parameters

- `context`: An instance of doc://com.apple.uikit/documentation/UIKit/UIFocusUpdateContext containing metadata of the focus related update.
- `coordinator`: An instance of doc://com.apple.uikit/documentation/UIKit/UIFocusAnimationCoordinator used for coordinating focus-related animations.

## Discussion

Discussion After the focus is updated to a new view, the focus engine calls this method on all focus environments that contain either the previously focused view, the next focused view, or both, in ascending order. You should override this method to update your app’s state in response to changes in focus. Use the provided animation coordinator to animate changes in visual appearance related to the update. For more information on animation coordinators, see UIFocusAnimationCoordinator.
