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
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Bring desktop class sync to iOS with FileProvider

    Discover how you can sync files faster and more efficiently within your iPhone and iPad apps when you create a File Provider extension. Sync up with the File Provider team and learn how to build a modern File Provider for iOS. We'll show you how to architect your app to support seamless file sync, uploads, and downloads. And we'll explore how you can go stateless and fortify your file provider against unexpected conditions.

    To get the most out of this session, we recommend having experience with File Providers on macOS.

    Recursos

    • Synchronizing files using file provider extensions
    • Sending notification requests to APNs
    • File Provider UI
    • File Provider
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC21

    • Sync files to the cloud with FileProvider on macOS
  • Buscar neste vídeo...
    • 6:04 - Implement a Progress Cancellation Handler

      // Implementing a progress cancellation handler
      
      public func modifyItem(_ item: ..., completionHandler: (..., Error?) -> Void) -> Progress {
          let progress = Progress()
          let uploadTask = Task {
              do {
                  // ...
                  try Task.checkCancellation()
                  // ...
              } catch let error {
                  completionHandler(nil, [], false, error)
              }
          }
      
          progress.cancellationHandler = {
              uploadTask.cancel()
          }
          return progress
      }
    • 6:53 - Register for Push Notifications

      // Registering for push notifications
      
      import PushKit
      
      let pushRegistry = PKPushRegistry(queue: queue)
      
      pushRegistry.delegate = self
      pushRegistry.desiredPushTypes = Set([PKPushType.fileProvider])
      
      ...
      
      // On the server: push
      //
      // {
      //    "container-identifier" = "NSFileProviderWorkingSetContainerItemIdentifier"
      //    "domain" = "<domain identifier>"
      // }
      //
      // with topic "<your application identifier>.pushkit.fileprovider"
    • 8:53 - Drag and Drop: Implement Dragging

      // Sending out drags
      
      var body: some View {
          Text("🥐")
          .onDrag {
              let itemProvider = NSItemProvider()
              itemProvider.registerFileRepresentation(for: .folder,
                                                      openInPlace: true) { completionHandler in
                  self.manager.getUserVisibleURL(for: folderItemID) { fileURL, error in
                      guard let fileURL = fileURL else {
                          completionHandler(nil, false, error)
                          return
                      }
                      completionHandler(fileURL, true, nil)
                  }
                  return Progress()  
              }
              return itemProvider
          }
      }
    • 9:24 - Drag and Drop: Implement Dropping

      // Receiving drops
      
      var body: some View {
          Text("🥬")
          .onDrop(of: [.folder], isTargeted: $dropTarget) { providers in
              guard let prov = providers.first(where: { provider in
                  !provider.registeredContentTypes(conformingTo: .folder).isEmpty
              }) else {
                  return false
              }
              prov.loadFileRepresentation(for: .folder, openInPlace: true) { url, inPlace, err in
                  guard let url = url else { return }
                  Task {
                      url.startAccessingSecurityScopedResource()
                      // use URL
                      url.stopAccessingSecurityScopedResource()
                  }
              }
              return true
          }
      }

Developer Footer

  • Vídeos
  • Tech Talks
  • Bring desktop class sync to iOS with FileProvider
  • 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