<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionController/didMoveTab(_:from:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:So24WKWebExtensionControllerC6WebKitE10didMoveTab_4from2inySo0abH0_p_SiSo0aB6Window_pSgtF"
  },
  "title" : "didMoveTab(_:from:in:)"
}
-->

# didMoveTab(_:from:in:)

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

```
@MainActor @preconcurrency func didMoveTab(_ movedTab: any WKWebExtensionTab, from index: Int, in oldWindow: (any WKWebExtensionWindow)? = nil)
```

## Parameters

`movedTab`

The tab that was moved.

`index`

The old index of the tab within the window.

`oldWindow`

The window that the tab was moved from, or `nil` if the tab is moving from no open window.

## Discussion

This method informs all loaded extensions of the movement of a tab, ensuring consistent understanding across extensions.

If the window is staying the same, the current window should be specified. If the intention is to inform only a specific extension, use the respective method on that extension’s context instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)