a8a9ad64f3
- Imports de CoreData que faltaban (MemberImportVisibility) en AccountsView, ImportDataView, ChartsContainerView y AddSourceView. - Aislamiento MainActor: IsolatedDefaultValues en el target de la app, LinearGradient @MainActor, WatchSyncMessage nonisolated, closures de ReviewPromptService/MonthlyCheckInStore/AppIntents. - Warnings de valores sin usar (SnapshotGapDetector, DashboardLayoutStore, OnboardingView, GoalEditorView, CoreDataStack, SettingsViewModel). - foregroundColor→foregroundStyle, cornerRadius→clipShape, navigationBarLeading/Trailing→topBarLeading/Trailing, Task.sleep(nanoseconds:)→sleep(for:), NavigationLink(isActive:)→ navigationDestination(isPresented:). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F1u4K16xy7eQVtgsYNZ9Vn
43 lines
1.2 KiB
Swift
43 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct GoalProgressBar: View {
|
|
let progress: Double
|
|
var tint: Color = .appSecondary
|
|
var background: Color = Color.gray.opacity(0.15)
|
|
var iconName: String = "flag.checkered"
|
|
var iconColor: Color = .appSecondary
|
|
|
|
private var clampedProgress: CGFloat {
|
|
CGFloat(min(max(progress, 0), 1))
|
|
}
|
|
|
|
var body: some View {
|
|
GeometryReader { geometry in
|
|
let width = geometry.size.width
|
|
let iconOffset = max(0, width * clampedProgress - 10)
|
|
|
|
ZStack(alignment: .leading) {
|
|
Capsule()
|
|
.fill(background)
|
|
Capsule()
|
|
.fill(tint)
|
|
.frame(width: width * clampedProgress)
|
|
}
|
|
.overlay(alignment: .leading) {
|
|
Image(systemName: iconName)
|
|
.font(.caption2)
|
|
.foregroundStyle(iconColor)
|
|
.offset(x: iconOffset)
|
|
}
|
|
}
|
|
.frame(height: 8)
|
|
.accessibilityLabel("Goal progress")
|
|
.accessibilityValue("\(Int(progress * 100)) percent")
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
GoalProgressBar(progress: 0.45)
|
|
.padding()
|
|
}
|