Is changing the GroupActivity by replacing still the preferred way?

Hi there,

I'm currently trying to implement SharePlay for one of my apps. Thanks to session wwdc21-10187, most of it went pretty smoothly. But at the end of the video, Adam talks about how to change activities and that's where I now struggle. He says that it is the preferred way to just replace the GroupActivity and demonstrates it for the reset button of the DrawTogether app. But this causes some behavior in iOS 15.1 that I would rather avoid.

Let's say we have a FaceTime call with two participants, A and B and use the DrawTogether app. A starts the GroupActivity. If A now resets the canvas, a notification stating

Started Draw Together

will appear for both users. This is not super nice, but I could live with that. But if B wants to reset the canvas, B will see an alert that states:

Replace Draw Together? This will end the existing SharePlay activity and start a new one

, with the option to "Replace Existing" or "Cancel". This will most likely throw the user B off - B just wanted to clean the canvas and stay in the same session (they shouldn't even need to think about sessions)

So my question is - Is changing the GroupActivity by replacing it still the preferred way if we want to have a clean slate? And if it is, how can I get rid of that alert that B sees? This is probably possible by actually doing the replacement through A (so through the GroupActivity "creator/owner"), but as far as I saw it in the documentation, there is currently no way to get that "owner", right?

To give a bit more context - I have an app where participants go through lessons together. They do not care about the history of completed lessons, every lesson should start from a clean slate. Through interaction, any participant could trigger the progression to the next lesson and so it is pretty distracting if this progression is interrupted by the aforementioned alert.

BTW: The code example is great, but as someone already noted over here, it does not compile since the API changed a bit (currently on iOS 15.1, but it was already broken before that).

Thanks! Klemens

Replies

Quite frankly, I don't think that replacing the GroupActivity is the right way to reset the canvas in the sample app.

The GroupActivity session is the connection over which the applications exchange data. The state of the canvas is the application's responsibility.

The example was probably adapted from SharePlay, which is built on top of GroupActivities. SharePlay uses a GroupActivity to exchange data about playback state. The application should not mix into that, and so the application changes the GroupActivity session when the user(s) want to play something different.