---
title: "didFocusWindow(_:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontroller/didfocuswindow(_:)"
---

# didFocusWindow(_:)

Should be called by the app when a window gains focus to fire appropriate events with all loaded web extensions.

## Declaration

```swift
func didFocusWindow(_ focusedWindow: (any WKWebExtensionWindow)?)
```

## Parameters

- `focusedWindow`: The window that gained focus, or \c nil if no window has focus or a window has focus that is not visible to extensions.

## Discussion

Discussion This method informs all loaded extensions of the focused window, ensuring consistent understanding across extensions. If the intention is to inform only a specific extension, you should use the respective method on that extension’s context instead.
