DrawTogether example code?

Would like to play with this example project shown on session wwdc21-10187

Replies

I'll second that, this would be extremely useful for me. I filed FB9163026 in case that helps.

  • It says "feedback not found."

  • I think it only works for the person who filed it (me) and people at Apple

  • Oh I see. Well, I hope the sample code is released. Do we know the data size limitations, by the way?

I third that. I'm building an application right now that would benefit greatly from this example. Please release it!

I fourth that.

I love that Apple exposed Group Activity as an API. Would only make sense to make DrawTogether available as sample code.

I fifth that.

I have recreated the code from the video as much as Apple has shown however I am missing some parts of it. I am not a SwiftUI expert but if someone takes up the challenge to continue it I am more than happy to upload it to GitHub.

By the way, I attended a GroupActivities lab and the engineer seemed surprised the code wasn't up. He indicated that it'd probably go up eventually, but it's unclear whether this was guaranteed.

I sixth that.

On my part, I've cobbled together something using PencilKit, and would be more than happy to share my buggy code if anyone's interested.

  • Hi Ivanmah, I am interested in your implementation if you would like to share it on GitHub or via email?

  • Hi @dverbenyi, I have uploaded my code to GitHub here.

  • Thanks @ivanmah That's a great head start!!

Thank you @ivanmah for sharing.

Found it! I downloaded the sample code for DrawTogether here

edit: all good! (I didn't realize the call had to be started beforehand) Has anyone actually been able to successfully run the code in the project shared above? It seems that .isEligibleForGroupSession is always false on my device. I'm on the second beta of Xcode and the second beta of iOS 15.

  • Do you know if it's possible to start a call in the background after the application has started, assuming we add some application logic to attempt to re-initialize at runtime?

    Also, I didn't realize this application was so SwiftUI-heavy. Admittedly, I don't know if I understand it. It looks like the drawing primitives are all swift UI. I roll by own Metal renderer. Is it possible to send non-SwiftUI data if I make some sort of encodable/decodable representation of my user input data? I am trying to figure out how to convert things.

Add a Comment

As is possible with beta changes, the sample code no longer compiles.

One fix was easy: a button style for prominence was explicitly added in beta 5 -- now it is

    Button {
        canvas.startSharing()
        } label: {
        Image(systemName: "person.2.fill")
        }
        .buttonStyle(.borderedProminent)

The other fix I am less sure of: the type alias for Task.Handle was deprecated, and if I use just Task it compiles, but now SharePlay won't start the Group Activity - it instead shows a toast where you have to "Choose Content to Use SharePlay".

It's unclear if this is a side effect of the Task change, or if there is an undocumented change in GroupActivities. Has anyone succeeded in running this code lately?

Thanks.

  • Strange, it's compiling and running successfully on my devices. Are you on the latest beta of Xcode 13 and iOS 15? Once you replace the "async" keyword for the async blocks with "Task" that should be enough to compile and run. You will also have to make the appropriate changes to the Task set and tasks.insert() lines.

  • Thanks for the info @sabyankees, but I'm still having trouble running this sample code using Xcode 13 and iOS 15.1 I've changed: .controlProminence(.increased) TO .buttonStyle(.borderedProminent) (thanks @anthroDevChris) And changed: "async" TO "Task" And changed: var tasks = Set<Task.Handle<Void, Never>>() TO var tasks = Set<Task<Void, Never>>() But I still get "'async' call in a function that does not support concurrency"

    I don't understand what you meant by changes to 'tasks.insert'.

    Could someone be even more specific to help me get started?

  • For anyone else struggling, I changed the startSharing function in Canvas as below, and the code is running now. I'm not very current on concurrency, so I may have broken more than I fixed.

    `func startSharing()  {

            Task{

               try await DrawTogether().activate()}

        }`

Add a Comment