---
title: "didReplaceTab(_:with:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontroller/didreplacetab(_:with:)"
---

# didReplaceTab(_:with:)

Should be called by the app when a tab is replaced by another tab to fire appropriate events with all loaded web extensions.

## Declaration

```swift
func didReplaceTab(_ oldTab: any WKWebExtensionTab, with newTab: any WKWebExtensionTab)
```

## Parameters

- `oldTab`: The tab that was replaced.
- `newTab`: The tab that replaced the old tab.

## Discussion

Discussion This method informs all loaded extensions of the replacement of a tab, 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.
