<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GroupActivities",
  "identifier" : "/documentation/GroupActivities/GroupSessionJournal",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Group Activities"
    ],
    "preciseIdentifier" : "s:15GroupActivities0A14SessionJournalC"
  },
  "title" : "GroupSessionJournal"
}
-->

# GroupSessionJournal

An object that manages file and data transfers between participants
joined in a group session.

```
final class GroupSessionJournal
```

## Overview

A [`GroupSessionJournal`](/documentation/GroupActivities/GroupSessionJournal) object lets you transfer files
and other data objects between participants of a shared activity. A journal object
isn’t a replacement for a [`GroupSessionMessenger`](/documentation/GroupActivities/GroupSessionMessenger) object,
which you use to transfer time-sensitive messages and commands
between participants. Instead, use it to associate files and other data objects
with the activity. For example, you might share images that people drag
into your app as part of the activity. The journal makes these data objects
available to all participants, regardless of when they joined the session.

After your app joins an activity and receives a session object, create
a [`GroupSessionJournal`](/documentation/GroupActivities/GroupSessionJournal) object and store a strong reference
to it. To add a file or data object to the group’s journal, call the [`add(_:)`](/documentation/GroupActivities/GroupSessionJournal/add(_:))
or [`add(_:metadata:)`](/documentation/GroupActivities/GroupSessionJournal/add(_:metadata:)) method with the data you want to share. The types you
specify must adopt the <doc://com.apple.documentation/documentation/CoreTransferable/Transferable>
protocol from the Core Transferable framework. The journal object
uses that protocol to package a version of your data suitable for sending
to other devices.

To receive data that a participant added to the journal, configure a task
to listen for asynchronous updates to the [`attachments`](/documentation/GroupActivities/GroupSessionJournal/attachments-swift.property) property of your
[`GroupSessionJournal`](/documentation/GroupActivities/GroupSessionJournal) object. When someone adds or removes an attachment,
the journal updates the array and executes your task. Load the contents
of an attachment using the [`load(_:)`](/documentation/GroupActivities/GroupSessionJournal/Attachment/load(_:)) method of that type. You
can also retrieve any attachment-specific metadata, such as a shared ID or
display name, that you included with the attached file. The following example
creates a task that waits on a custom image type. The `journal`
variable contains a previously configured [`GroupSessionJournal`](/documentation/GroupActivities/GroupSessionJournal)
object.

```
let attachmentListener = Task {
   for await attachments in journal.attachments {
       for attachment in attachments {
           let receivedItem = try await attachment.load(MyImageItem.self)
           // Do something with the item you receive.
       }
   }
}
```

## Topics

### Creating an attachment manager

[`convenience init<Activity>(session: GroupSession<Activity>)`](/documentation/GroupActivities/GroupSessionJournal/init(session:))

Creates a journal and associates it with the specified
session of a group activity.

### Uploading content to the session

[`func add<ItemType>(ItemType) async throws -> GroupSessionJournal.Attachment`](/documentation/GroupActivities/GroupSessionJournal/add(_:))

Adds the specified item to the journal and begins transferring the
item’s data to the other participants’ devices so they can access it.

[`func add<ItemType, MetadataType>(ItemType, metadata: MetadataType) async throws -> GroupSessionJournal.Attachment`](/documentation/GroupActivities/GroupSessionJournal/add(_:metadata:))

Adds the specified item and metadata to the journal and begins transferring the
data to the other participants’ devices so they can access it.

### Downloading content from the session

[`var attachments: GroupSessionJournal.Attachments`](/documentation/GroupActivities/GroupSessionJournal/attachments-swift.property)

The currently available attachments for you to download
and incorporate into your app.

[`struct Attachments`](/documentation/GroupActivities/GroupSessionJournal/Attachments-swift.struct)

An asynchronous sequence that contains one or more incoming attachment
containers for you to process.

[`struct Attachment`](/documentation/GroupActivities/GroupSessionJournal/Attachment)

A container for the data you download.

### Removing content from the session

[`func remove(attachment: GroupSessionJournal.Attachment) async throws`](/documentation/GroupActivities/GroupSessionJournal/remove(attachment:))

Removes the specified attachment from the journal on all sessions.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)