<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GroupActivities",
  "identifier" : "/documentation/GroupActivities/GroupSession/leave()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Group Activities"
    ],
    "preciseIdentifier" : "s:15GroupActivities0A7SessionC5leaveyyF"
  },
  "title" : "leave()"
}
-->

# leave()

Leaves the current activity and stops receiving synchronized data.

```
final func leave()
```

## Discussion

When you call this method, the session transitions to the [`GroupSession.State.invalidated(reason:)`](/documentation/GroupActivities/GroupSession/State-swift.enum/invalidated(reason:))
state and stops the delivery of session-related updates. Call this method
when the user dismisses your app’s activity-related UI.

Don’t call this method on a session already in the [`GroupSession.State.invalidated(reason:)`](/documentation/GroupActivities/GroupSession/State-swift.enum/invalidated(reason:)) state.

---

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)