From 9741b7d83459246af48ef6157a9d9fed61b52104 Mon Sep 17 00:00:00 2001 From: rzen Date: Thu, 16 Jul 2026 19:44:22 -0400 Subject: [PATCH] Pick rest time on a 1-second wheel Replaces the 5-second Steppers in Settings and the routine editor's custom-rest row with a shared SecondsWheelRow: the row shows the value and tapping it expands an inline wheel (10-180s, 1s steps) beneath. --- CHANGELOG.md | 2 + Workouts/Views/Common/SecondsWheelRow.swift | 47 +++++++++++++++++++ .../Views/Routines/RoutineAddEditView.swift | 8 +--- Workouts/Views/Settings/SettingsView.swift | 8 +--- 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 Workouts/Views/Common/SecondsWheelRow.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index e30bac0..5c34296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ **July 2026** +Rest time is now set on a wheel with one-second precision — in Settings and in a routine's custom rest — instead of a 5-second stepper. + A live status panel between the timer and the figure now shows heart rate (with the target color cues, in much larger type), HR zone, calories, and workout time. A new Library tab puts your routines and the exercise library one tap away instead of buried in Settings. diff --git a/Workouts/Views/Common/SecondsWheelRow.swift b/Workouts/Views/Common/SecondsWheelRow.swift new file mode 100644 index 0000000..a547f0b --- /dev/null +++ b/Workouts/Views/Common/SecondsWheelRow.swift @@ -0,0 +1,47 @@ +// +// SecondsWheelRow.swift +// Workouts +// +// Copyright 2026 Rouslan Zenetl. All Rights Reserved. +// + +import SwiftUI + +/// A Form row for picking a seconds value on an inline wheel: the row shows the +/// current value; tapping it expands (or collapses) a wheel beneath with 1-second +/// steps. Used for the rest-time settings, where the old 5-second stepper was too +/// coarse and too slow to traverse a 10–180s range. +struct SecondsWheelRow: View { + let title: String + let range: ClosedRange + @Binding var seconds: Int + + @State private var expanded = false + + var body: some View { + Button { + withAnimation { expanded.toggle() } + } label: { + HStack { + Text(title) + .foregroundStyle(.primary) + Spacer() + Text("\(seconds)s") + .monospacedDigit() + .foregroundStyle(expanded ? AnyShapeStyle(.tint) : AnyShapeStyle(.secondary)) + } + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + + if expanded { + Picker(title, selection: $seconds) { + ForEach(range, id: \.self) { s in + Text("\(s)s").tag(s) + } + } + .pickerStyle(.wheel) + .labelsHidden() + } + } +} diff --git a/Workouts/Views/Routines/RoutineAddEditView.swift b/Workouts/Views/Routines/RoutineAddEditView.swift index 7a2fb8f..467a8bb 100644 --- a/Workouts/Views/Routines/RoutineAddEditView.swift +++ b/Workouts/Views/Routines/RoutineAddEditView.swift @@ -132,13 +132,7 @@ struct RoutineAddEditView: View { Toggle("Custom Rest Time", isOn: $restOverrideEnabled) if restOverrideEnabled { - Stepper(value: $restSecondsValue, in: 10...180, step: 5) { - HStack { - Text("Rest Time") - Spacer() - Text("\(restSecondsValue)s").foregroundColor(.secondary) - } - } + SecondsWheelRow(title: "Rest Time", range: 10...180, seconds: $restSecondsValue) } } header: { Text("Rest & Pacing") diff --git a/Workouts/Views/Settings/SettingsView.swift b/Workouts/Views/Settings/SettingsView.swift index 7580884..8ec1b2c 100644 --- a/Workouts/Views/Settings/SettingsView.swift +++ b/Workouts/Views/Settings/SettingsView.swift @@ -33,13 +33,7 @@ struct SettingsView: View { Form { // MARK: - Workout Section Section { - Stepper(value: $restSeconds, in: 10...180, step: 5) { - HStack { - Text("Rest Between Sets") - Spacer() - Text("\(restSeconds)s").foregroundColor(.secondary) - } - } + SecondsWheelRow(title: "Rest Between Sets", range: 10...180, seconds: $restSeconds) Stepper(value: $doneCountdownSeconds, in: 3...20, step: 1) { HStack {