<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CompositorContent/onWorldRecenter(action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17CompositorContentPAAE15onWorldRecenter6actionQryyScMYcc_tF::OverloadGroup"
  },
  "title" : "onWorldRecenter(action:)"
}
-->

# onWorldRecenter(action:)

Adds an action to perform when recentering the view with the
digital crown.

```
nonisolated func onWorldRecenter(action: @escaping @MainActor () -> Void) -> some CompositorContent
```

## Parameters

`action`

A closure to run when the content is recentered.
This will run when the app has been recentered and is
about to fade back in, equivalent to `WorldRecenterPhase.ended`.

## Discussion

When the user recenters their content, the app will fade out and then be
repositioned. Once it has been repositioned, the action will be called
and the app will fade back in. The action will be called if the app
is not backgrounded or suspended.

---

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)