---
title: "didActivateTab(_:previousActiveTab:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontroller/didactivatetab(_:previousactivetab:)"
---

# didActivateTab(_:previousActiveTab:)

Should be called by the app when a tab is activated to notify all loaded web extensions.

## Declaration

```swift
@MainActor @preconcurrency func didActivateTab(_ activatedTab: any WKWebExtensionTab, previousActiveTab previousTab: (any WKWebExtensionTab)? = nil)
```

## Parameters

- `activatedTab`: The tab that has become active.
- `previousTab`: The tab that was active before. This parameter can be \c nil if there was no previously active tab.

## Discussion

Discussion This method informs all loaded extensions of the tab activation, ensuring consistent state awareness across extensions. If the intention is to inform only a specific extension, use the respective method on that extension’s context instead.
