diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d44097..735606d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ Workouts is now on the Mac: a native app for managing routines and schedules and browsing the exercise library, synced through the same iCloud Drive. -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. +Rest time now adjusts in one-second steps — in Settings and in a routine's custom rest — instead of five-second jumps. 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. diff --git a/Workouts/Views/Common/SecondsStepperRow.swift b/Workouts/Views/Common/SecondsStepperRow.swift new file mode 100644 index 0000000..8dfadbd --- /dev/null +++ b/Workouts/Views/Common/SecondsStepperRow.swift @@ -0,0 +1,30 @@ +// +// SecondsStepperRow.swift +// Workouts +// +// Copyright 2026 Rouslan Zenetl. All Rights Reserved. +// + +import SwiftUI + +/// A Form row for adjusting a seconds value with a stepper in 1-second steps — +/// fine-grained (the old 5-second step overshot), and holding a stepper button +/// auto-repeats with acceleration, so the 10–180s range still traverses quickly. +/// Used for the rest-time settings in Settings and the routine editor. +struct SecondsStepperRow: View { + let title: String + let range: ClosedRange + @Binding var seconds: Int + + var body: some View { + Stepper(value: $seconds, in: range, step: 1) { + HStack { + Text(title) + Spacer() + Text("\(seconds)s") + .monospacedDigit() + .foregroundStyle(.secondary) + } + } + } +} diff --git a/Workouts/Views/Common/SecondsWheelRow.swift b/Workouts/Views/Common/SecondsWheelRow.swift deleted file mode 100644 index a547f0b..0000000 --- a/Workouts/Views/Common/SecondsWheelRow.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// 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 467a8bb..551c1a5 100644 --- a/Workouts/Views/Routines/RoutineAddEditView.swift +++ b/Workouts/Views/Routines/RoutineAddEditView.swift @@ -132,7 +132,7 @@ struct RoutineAddEditView: View { Toggle("Custom Rest Time", isOn: $restOverrideEnabled) if restOverrideEnabled { - SecondsWheelRow(title: "Rest Time", range: 10...180, seconds: $restSecondsValue) + SecondsStepperRow(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 8ec1b2c..71ab0f7 100644 --- a/Workouts/Views/Settings/SettingsView.swift +++ b/Workouts/Views/Settings/SettingsView.swift @@ -33,7 +33,7 @@ struct SettingsView: View { Form { // MARK: - Workout Section Section { - SecondsWheelRow(title: "Rest Between Sets", range: 10...180, seconds: $restSeconds) + SecondsStepperRow(title: "Rest Between Sets", range: 10...180, seconds: $restSeconds) Stepper(value: $doneCountdownSeconds, in: 3...20, step: 1) { HStack {