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

# didReplaceTab(_:with:)

Called by the app when a tab is replaced by another tab to fire appropriate events with only this extension.

## 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 only the specific extension that a tab has been replaced. If the intention is to inform all loaded extensions consistently, you should use the respective method on the extension controller instead.
