implement settings

This commit is contained in:
2026-01-27 02:39:24 +01:00
parent f45f7db10b
commit 5f05da552d
5 changed files with 124 additions and 19 deletions

View File

@@ -9,6 +9,7 @@ import SwiftUI
struct StopwatchRow: View {
@ObservedObject var stopwatch: Stopwatch
@ObservedObject var settings = AppSettings.shared
var onDelete: () -> Void
var body: some View {
@@ -16,7 +17,7 @@ struct StopwatchRow: View {
VStack(alignment: .leading) {
Text(stopwatch.name)
.font(.headline)
Text("\(stopwatch.formattedTime)")
Text("\(stopwatch.formattedTime(format: settings.timeFormat))")
.font(.largeTitle)
.monospacedDigit()
}
@@ -33,19 +34,9 @@ struct StopwatchRow: View {
Image(systemName: stopwatch.isRunning ? "pause.circle.fill" : "play.circle.fill")
.resizable()
.frame(width: 44, height: 44)
.foregroundStyle(stopwatch.isRunning ? .orange : .green)
}
.buttonStyle(PlainButtonStyle())
Button(action: onDelete) {
Image(systemName: "trash.circle.fill")
.resizable()
.frame(width: 44, height: 44)
.foregroundColor(.red)
.foregroundStyle(stopwatch.isRunning ? .yellow : .green)
}
.buttonStyle(PlainButtonStyle())
.padding(.leading, 10)
}
.padding(.vertical, 8)
}