---
title: "shouldUpdateFocus(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uifocusenvironment/shouldupdatefocus(in:)"
---

# shouldUpdateFocus(in:)

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

## Declaration

```swift
func shouldUpdateFocus(in context: UIFocusUpdateContext) -> Bool
```

## Parameters

- `context`: An instance of doc://com.apple.uikit/documentation/UIKit/UIFocusUpdateContext class, containing metadata for the focus related update.

## Return Value

Return Value true to allow the focus update; otherwise, false.

## Discussion

Discussion When a focus update is about to occur, 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. If any environment returns false, the update is cancelled. Override this method to prevent the focus from moving to or from certain areas of the screen.
