-
Build custom experiences with Group Activities
Go beyond basic streaming and interaction and discover how you can build advanced SharePlay experiences using the full power of the Group Activities framework. We'll show you how to adapt a simple drawing app into a real-time shared canvas, explore APIs like GroupSessionMessenger — which helps send and receive custom messages between participants in the group — and learn how to put the finishing touches on a custom SharePlay experience.
Recursos
Videos relacionados
WWDC23
WWDC21
-
Buscar este video…
-
-
3:50 - Configuring your application’s activity
struct DrawTogether: GroupActivity { var metadata: GroupActivityMetadata { var metadata = GroupActivityMetadata() metadata.title = NSLocalizedString("Draw Together", comment: "Title of group activity") metadata.type = .generic return metadata } } -
10:06 - Define, Receive and Send messages
let messenger = GroupSessionMessenger(session: groupSession) // 1. Define struct UpsertStrokeMessage: Codable { let id: UUID let color: Color let point: CGPoint } // 2. Receive for await (message, context) in messenger.messages(of: UpsertStrokeMessage.self) { // Handle message } // 3. Send do { try await messenger.send(UpsertStrokeMessage(id: stroke.id, color: .red, point: point)) } catch { // Handle error }
-