FileSaveDialogs.swift 1.1 KB

123456789101112131415161718192021222324252627
  1. import Foundation
  2. extension BackendFeatures {
  3. /// Backend methods for file save dialogs.
  4. ///
  5. /// These are used by ``EnvironmentValues/chooseFileSaveDestination``.
  6. @MainActor
  7. public protocol FileSaveDialogs: Core {
  8. /// Presents a 'Save file' dialog to the user for selecting a file save
  9. /// destination.
  10. ///
  11. /// - Parameters:
  12. /// - fileDialogOptions: The general file dialog options to use.
  13. /// - saveDialogOptions: The save dialog-specific options to use.
  14. /// - window: The window to attach the dialog to. If `nil`, the backend
  15. /// can either make the dialog a whole app modal, a standalone window,
  16. /// or a modal for a window of its choosing.
  17. /// - handleResult: The action to perform when the user chooses a
  18. /// destination or cancels the dialog. Receives a `DialogResult<URL>`.
  19. func showSaveDialog(
  20. fileDialogOptions: FileDialogOptions,
  21. saveDialogOptions: SaveDialogOptions,
  22. window: Window?,
  23. resultHandler handleResult: @escaping (DialogResult<URL>) -> Void
  24. )
  25. }
  26. }