<!--
{
  "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/state-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Group Activities"
    ],
    "preciseIdentifier" : "s:15GroupActivities0A7SessionC5stateAC5StateOyx_Gvp"
  },
  "title" : "state"
}
-->

# state

The current state of the session.

```
@Published<GroupSession<ActivityType>.State> final var state: GroupSession<ActivityType>.State { get }
```

## Discussion

Use this property to get the current state value, or configure a subscriber
to detect changes to the value. To change the state of a session, call
the [`join()`](/documentation/GroupActivities/GroupSession/join()) and [`leave()`](/documentation/GroupActivities/GroupSession/leave()) methods.

If a failure occurs or the session ends, the session object transitions to the
[`GroupSession.State.invalidated(reason:)`](/documentation/GroupActivities/GroupSession/State-swift.enum/invalidated(reason:))state. If the session ends because of
an error, it provides information about that error.

---

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)