1
0

ProgressBars.swift 945 B

123456789101112131415161718192021222324252627
  1. extension BackendFeatures {
  2. /// Backend methods for progress bars.
  3. ///
  4. /// These are used by ``ProgressView`` when initialized with a `Progress`
  5. /// instance.
  6. @MainActor
  7. public protocol ProgressBars: Core {
  8. /// Creates a progress bar.
  9. ///
  10. /// - Returns: A progress bar.
  11. func createProgressBar() -> Widget
  12. /// Updates a progress bar to reflect the given progress (between 0 and 1),
  13. /// and the current view environment.
  14. ///
  15. /// - Parameters:
  16. /// - widget: The progress bar to update.
  17. /// - progressFraction: The current progress. If `nil`, then the bar
  18. /// should show an indeterminate animation if possible.
  19. /// - environment: The current environment.
  20. func updateProgressBar(
  21. _ widget: Widget,
  22. progressFraction: Double?,
  23. environment: EnvironmentValues
  24. )
  25. }
  26. }