<!--
{
  "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/shouldUpdateFocus(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIFocusEnvironment(im)shouldUpdateFocusInContext:"
  },
  "title" : "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.

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

## Parameters

`context`

An instance of [`UIFocusUpdateContext`](/documentation/UIKit/UIFocusUpdateContext) class, containing metadata for the focus related update.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> to allow the focus update; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## 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 <doc://com.apple.documentation/documentation/Swift/false>, the update is cancelled. Override this method to prevent the focus from moving to or from certain areas of the screen.

---

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)