import SwiftUI /// Der dünne Balken unter angefangenen Titeln. public struct WatchProgressBar: View { /// 0…1. Werte außerhalb werden abgeschnitten, damit ein fehlerhafter /// Serverwert den Balken nicht über die Kachel hinausschieben kann. private let fraction: Double @Environment(\.haloAccent) private var accent public init(fraction: Double) { self.fraction = fraction.clamped() } public var body: some View { GeometryReader { proxy in ZStack(alignment: .leading) { Rectangle().fill(Color.white.opacity(0.15)) Rectangle() .fill(accent) .frame(width: proxy.size.width * fraction) } } .frame(height: 3) .accessibilityElement() .accessibilityLabel(Text("progress.watched", bundle: .module)) .accessibilityValue(Text(fraction.formatted(.percent.precision(.fractionLength(0))))) } }