FastRiseAlarmEditor.swift 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // LoopFollow
  2. // FastRiseAlarmEditor.swift
  3. // Created by Jonas Björkert on 2025-05-15.
  4. import SwiftUI
  5. struct FastRiseAlarmEditor: View {
  6. @Binding var alarm: Alarm
  7. var body: some View {
  8. Form {
  9. InfoBanner(
  10. text: "Alerts when glucose readings rise rapidly. For example, "
  11. + "three straight readings each climbing by at least the amount "
  12. + "you set. Optionally limit alerts to only fire above a certain BG.",
  13. alarmType: alarm.type
  14. )
  15. AlarmGeneralSection(alarm: $alarm)
  16. AlarmBGSection(
  17. header: "Rate of Rise",
  18. footer: "This is how much the glucose must rise to be considered a fast rise.",
  19. title: "Rises by",
  20. range: 3 ... 54,
  21. value: Binding(
  22. get: { alarm.delta ?? 10 }, // This value has not effect since it is set as default on the alarm
  23. set: { alarm.delta = $0 }
  24. )
  25. )
  26. AlarmStepperSection(
  27. header: "Consecutive Rises",
  28. footer: "Number of rises—each meeting the rate above—"
  29. + "required before an alert fires.",
  30. title: "Rises in a row",
  31. range: 1 ... 3,
  32. step: 1,
  33. value: $alarm.monitoringWindow
  34. )
  35. AlarmBGLimitSection(
  36. header: "BG Limit",
  37. footer: "When enabled, this alert only fires if the glucose is "
  38. + "above the limit you set.",
  39. toggleText: "Use BG Limit",
  40. pickerTitle: "Rising above",
  41. range: 40 ... 300,
  42. defaultOnValue: 200,
  43. value: $alarm.aboveBG
  44. )
  45. AlarmActiveSection(alarm: $alarm)
  46. AlarmAudioSection(alarm: $alarm)
  47. AlarmSnoozeSection(alarm: $alarm)
  48. }
  49. .navigationTitle(alarm.type.rawValue)
  50. }
  51. }