View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Enhance collaboration experiences with Messages

    Discover how you can help improve communication and collaboration in your app with Collaboration in Messages. Learn how to tie a document to Messages conversations for simple sharing and discussion. Explore how you can keep everyone in the conversation up to date on the latest activity in the document. And find out how you can add customizable UI in your app to manage collaboration details and connect documents to Messages conversations and FaceTime calls.

    To learn more about the SharedWithYou framework, we recommend watching "Add Shared with You to your app.” For more information on adding collaboration APIs to apps that have custom collaboration infrastructure, check out "Integrate your custom collaboration app with Messages.”

    Recursos

      • Video HD
      • Video SD

    Videos relacionados

    WWDC22

    • Add Shared with You to your app
    • Integrate your custom collaboration app with Messages
    • Meet Transferable
    • What's new in AppKit
    • What's new in SwiftUI

    WWDC21

    • What's new in CloudKit
  • Buscar este video…
    • 4:08 - Create a CloudKit collaboration item provider

      // CloudKit collaboration object
      
      // Starting collaboration
      let itemProvider = NSItemProvider()
      itemProvider.registerCKShare(container: container, 
                                   allowedSharingOptions: CKAllowedSharingOptions.standard, 
                                   preparationHandler: {
          // Create your share and save to server, or throw error
          return savedShare
      })
      
      // Inviting to existing collaboration
      let itemProvider = NSItemProvider()
      itemProvider.registerCKShare(share, 
                                   container: container, 
                                   allowedSharingOptions: CKAllowedSharingOptions.standard)
    • 7:35 - Set up Share Sheet on iOS and Mac Catalyst

      // Setting up Share Sheet - iOS and Mac Catalyst
      
      let activityViewController = UIActivityViewController(activityItems: [collaborationObject], applicationActivities: nil)
      
      presentingViewController.present(activityViewController, animated: true)
    • 7:47 - Set up Share Popover on macOS

      // Setting up Share Popover - macOS
      
      let sharingServicePicker = NSSharingServicePicker(items: [collaborationObject])
      
      sharingServicePicker.show(relativeTo: view.bounds, of: view, preferredEdge: .minY)
    • 8:22 - Provide metadata for CloudKit collaboration in Share Sheet (iOS, Mac Catalyst)

      // Providing CloudKit metadata - iOS
      
      let configuration = UIActivityItemsConfiguration(itemProviders: [collaborationItemProvider])
      configuration.perItemMetadataProvider = { (_, key) in
          switch key {
          case .linkPresentationMetadata:
              // Create LPLinkMetadata with title and imageProvider
              return metadata
          default:
              return nil
          }
      }
      
      let activityViewController = UIActivityViewController(activityItemsConfiguration: configuration)
    • 9:03 - Provide metadata for CloudKit collaboration in Share Popover (macOS)

      // Providing CloudKit metadata - macOS
      
      let title = “Shared Item”
      let image = NSImage(contentsOfFile: “Shared_Item_Preview_Image.png”)
      let icon = NSImage(contentsOfFile: “App_Icon.png”) // Shared item source
      
      let previewRepresentingItem = NSPreviewRepresentingActivityItem(item: collaborationItemProvider, 
                                                                      title: title, 
                                                                      image: image, 
                                                                      icon: icon)
      
      let picker = NSSharingServicePicker(items: [previewRepresentingItem])
    • 10:21 - Create Transferable object for CloudKit collaboration with ShareLink

      // SwiftUI CloudKit Transferable
      
      struct Note: Transferable {
          // Properties of the note e.g. name, preview image, content, ID, …
          var share: CKShare?
          func saveCKShareToServer() async throws -> CKShare { … }
      
          static var transferRepresentation: some TransferRepresentation {
              CKShareTransferRepresentation { note in
                  if let share = note.share {
                      return .existing(share, container: container, options: options)
                  } else {
                      return .prepareShare(container: container, options: options) {
                          return try await note.saveCKShareToServer()
                      }
                  }
              }
          }
      }
    • 11:34 - Adopt ShareLink in SwiftUI

      // SwiftUI ShareLink adoption
      
      struct ContentView: View {
          @State let item = ShareItem()
      
          var body: some View {
              ShareLink(item: item, preview: SharePreview(item.title, image: item.previewImage))
          }
      }
    • 14:58 - Initialize the collaborationView

      // Collaboration View
      
      let collaborationView = SWCollaborationView(itemProvider: itemProvider)
      
      collaborationView.activeParticipantCount = myModel.activePeople.count
      
      collaborationView.contentView = MyView(model: myModel)
      
      collaborationView.manageButtonTitle = "Custom Manage Button"
    • 18:11 - Observe when CKShare is saved with CKSystemSharingUIObserver

      // Observing CKShare Changes
      
      let observer = CKSystemSharingUIObserver(container: container)
      
      observer.systemSharingUIDidSaveShareBlock = { _, result in
          switch result {
          case .success(let share):
              // Handle successfully starting share
          case .failure(let error):
              // Handle error
          }
      }
    • 18:47 - Observe when CKShare is removed with CKSystemSharingUIObserver

      // Observing CKShare Changes
      
      observer.systemSharingUIDidStopSharingBlock = { _, result in
          switch result {
          case .success(let share):
              // Handle successfully starting share
          case .failure(let error):
              // Handle error
          }
      }
    • 20:44 - Posting notice for edit SWHighlightChangeEvent

      // Post an SWHighlightChangeEvent Notice
      
      let highlightCenter: SWHighlightCenter = self.highlightCenter
      
      let highlight = try highlightCenter.collaborationHighlight(forURL: ckShareURL, error: &error)
      
      let editEvent = SWHighlightChangeEvent(highlight: highlight, trigger: .edit)
      
      highlightCenter.postNotice(for: editEvent)
    • 21:30 - Post an SWHighlightMentionEvent Notice

      // Post an SWHighlightMentionEvent Notice
      
      let highlightCenter: SWHighlightCenter = self.highlightCenter
      
      let highlight = try highlightCenter.collaborationHighlight(forURL: ckShareURL, error: &error)
      
      let mentionEvent = SWHighlightMentionEvent(highlight: highlight, 
                 mentionedPersonCloudKitShareHandle: ckShareParticipantHandle)
      
      highlightCenter.postNotice(for: mentionEvent)
    • 21:58 - Post an SWHighlightPersistenceEvent Notice

      // Post an SWHighlightPersistenceEvent Notice
      
      let highlightCenter: SWHighlightCenter = self.highlightCenter
      
      let highlight = try highlightCenter.collaborationHighlight(forURL: ckShareURL, error: &error)
      
      let renamedEvent = SWHighlightPersistenceEvent(highlight: highlight, trigger: .renamed)
      
      highlightCenter.postNotice(for: renamedEvent)
    • 22:11 - Post an SWHighlightMembershipEvent Notice

      // Post an SWHighlightMembershipEvent Notice
      
      let highlightCenter: SWHighlightCenter = self.highlightCenter
      
      let highlight = try highlightCenter.collaborationHighlight(forURL: ckShareURL, error: &error)
      
      let membershipEvent = SWHighlightMembershipEvent(highlight: highlight, 
                                                 trigger: .addedCollaborator)
      
      highlightCenter.postNotice(for: membershipEvent)

Developer Footer

  • Videos
  • WWDC22
  • Enhance collaboration experiences with Messages
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines