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.
Declaration
final func add<ItemType>(_ item: ItemType) async throws -> GroupSessionJournal.Attachment where ItemType : TransferableParameters
- item:
The item to send to other session participants. The type you specify must conform to the Transferable protocol. For more information about creating transferable types, see Coretransferable.
Return Value
An attachment object you can remove by passing it to the remove(attachment:) function.
Discussion
Call this method when you want to send a file or codable data type to the other participants of an activity. The method runs asynchronously and can return before the upload operation finishes.