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

# didFocusWindow(_:)

Called by the app when a window gains focus to fire appropriate events with only this extension.

## Declaration

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

## Parameters

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

## Discussion

Discussion This method informs only the specific extension that a window has gained focus. If the intention is to inform all loaded extensions consistently, you should use the respective method on the extension controller instead.
