implement settings
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user