// // 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() } } }