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

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 ↗

Transcript all transcripts

Chapters

Code shown on screen · 2 snippets

Defining your GroupActivity type swift · at 4:15 ↗
var metadata: GroupActivityMetadata {
    var metadata = GroupActivityMetadata()

    metadata.title =Order Tacos Together”

    metadata.type = .generic

    return metadata
}
Add SharePlay swift · at 9:50 ↗
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
    }
}