SettingsPresentationMode.swift 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // SettingsPresentationMode.swift
  3. // LoopKitUI
  4. //
  5. // Created by Anna Quinlan on 7/21/20.
  6. // Copyright © 2020 LoopKit Authors. All rights reserved.
  7. //
  8. /// Represents the different modes that settings screens might be represented in
  9. public enum SettingsPresentationMode {
  10. /// Presentation is in the onboarding acceptance flow
  11. case acceptanceFlow
  12. /// Presentation is under the settings ("gear icon") screen
  13. case settings
  14. }
  15. extension SettingsPresentationMode {
  16. /// Text for the button at the bottom of the settings screen
  17. func buttonText(isSaving: Bool = false) -> String {
  18. switch self {
  19. case .acceptanceFlow:
  20. return LocalizedString("Confirm Setting", comment: "The button text for confirming the setting")
  21. case .settings:
  22. if isSaving {
  23. return LocalizedString("Saving...", comment: "The button text during saving on a configuration page")
  24. } else {
  25. return LocalizedString("Save", comment: "The button text for saving on a configuration page")
  26. }
  27. }
  28. }
  29. }