Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2022 Audio & VideoApp Services

WWDC22 · 15 min · Audio & Video / App Services

What’s new in SharePlay

Join us as we share the latest updates to SharePlay. We’ll show you how you can start SharePlay sessions right from your app, take you through improvements to APIs to create richer experiences, and check out enhancements to GroupSessionMessenger. We’ll also explore best practices for adding SharePlay to your app.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 5 snippets

Register GroupActivity swift · at 2:06 ↗
// Register GroupActivity
let itemProvider = NSItemProvider()
itemProvider.registerGroupActivity(WatchTogether())

// Provide the ItemProvider to the ShareSheet
let configuration = UIActivityItemsConfiguration(itemProviders: [itemProvider])

UIActivityViewController(activityItemsConfiguration: configuration)
Not as prominent swift · at 2:14 ↗
let shareSheet = UIActivityViewController(activityItemsConfiguration: configuration)

// Show SharePlay non-prominently
shareSheet.allowsProminentActivity = false
Exclude swift · at 2:15 ↗
let shareSheet = UIActivityViewController(activityItemsConfiguration: configuration)

// Exclude SharePlay activity
shareSheet.excludedActivityTypes = [.sharePlay]
Show your own button to start SharePlay swift · at 2:44 ↗
let controller = GroupActivitySharingController(WatchTogetherActivity())
present(controller, animated: true)
Stroke Gesture swift · at 8:21 ↗
var strokeGesture: some Gesture {
    DragGesture()
        .onChanged { value in
            canvas.addPointToActiveStroke(value.location)
        }
        .onEnded { value in
            canvas.addPointToActiveStroke(value.location)
            canvas.finishStroke()
        }
}

Resources