2023 Audio & Video
WWDC23 · 14 min · Audio & Video
Add SharePlay to your app
Discover how your app can take advantage of SharePlay to turn any activity into a shareable experience with friends! We’ll share the latest updates to SharePlay, explore the benefits of creating shared activities, dive into some exciting use cases, and take you through best practices to create engaging and fun moments of connection in your app.
Watch at developer.apple.com ↗Chapters
Code shown on screen · 2 snippets
Defining your GroupActivity type
var metadata: GroupActivityMetadata {
var metadata = GroupActivityMetadata()
metadata.title = “Order Tacos Together”
metadata.type = .generic
return metadata
} Add SharePlay
import GroupActivities
struct OrderTogether: GroupActivity {
// Define a unique activity identifier for system to reference
static let activityIdentifier = "com.example.apple-samplecode.TacoTruck.OrderTogether"
// App-specific data so your app can launch the activity on others' devices
let orderUUID: UUID
let truckName: String
var metadata: GroupActivityMetadata {
var metadata = GroupActivityMetadata()
metadata.title = "Order Tacos Together"
metadata.subtitle = truckName
metadata.previewImage = UIImage(named: "ActivityImage")?.cgImage
metadata.type = .shopTogether
return metadata
}
} Related sessions
-
16 min -
25 min -
10 min