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 ↗Code shown on screen · 5 snippets
Register GroupActivity
// 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
let shareSheet = UIActivityViewController(activityItemsConfiguration: configuration)
// Show SharePlay non-prominently
shareSheet.allowsProminentActivity = false Exclude
let shareSheet = UIActivityViewController(activityItemsConfiguration: configuration)
// Exclude SharePlay activity
shareSheet.excludedActivityTypes = [.sharePlay] Show your own button to start SharePlay
let controller = GroupActivitySharingController(WatchTogetherActivity())
present(controller, animated: true) Stroke Gesture
var strokeGesture: some Gesture {
DragGesture()
.onChanged { value in
canvas.addPointToActiveStroke(value.location)
}
.onEnded { value in
canvas.addPointToActiveStroke(value.location)
canvas.finishStroke()
}
} Resources
Related sessions
-
16 min -
19 min -
11 min