BuildExpireAlarmEditor.swift 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // BuildExpireAlarmEditor.swift
  3. // LoopFollow
  4. //
  5. // Created by Jonas Björkert on 2025-04-21.
  6. // Copyright © 2025 Jon Fawcett. All rights reserved.
  7. //
  8. import SwiftUI
  9. struct BuildExpireAlarmEditor: View {
  10. @Binding var alarm: Alarm
  11. var body: some View {
  12. Form {
  13. AlarmGeneralSection(alarm: $alarm)
  14. AlarmThresholdSection(
  15. title: "Expires In",
  16. range: 1...14,
  17. step: 1,
  18. unitLabel: alarm.type.timeUnit.label,
  19. value: Binding(
  20. get: { Double(alarm.threshold ?? 1) },
  21. set: { alarm.threshold = Float($0) }
  22. )
  23. )
  24. AlarmSnoozeSection(
  25. title: "Default Snooze",
  26. range: 1...14,
  27. step: 1,
  28. unitLabel: alarm.type.timeUnit.label,
  29. value: Binding(
  30. get: { Double(alarm.snoozeDuration) },
  31. set: { alarm.snoozeDuration = Int($0) }
  32. )
  33. )
  34. AlarmAudioSection(alarm: $alarm)
  35. AlarmActiveSection(alarm: $alarm)
  36. AlarmSnoozedUntilSection(alarm: $alarm)
  37. }
  38. .navigationTitle(alarm.type.rawValue)
  39. }
  40. }