fix(analytics): mark WorkoutSnapshot.init(vm:) @MainActor
Build error (Xcode, Swift 6 strict concurrency): WorkoutSnapshot.init(vm:) read history/workoutDates/schedule/missedDates from @MainActor WorkoutViewModel in a nonisolated init. The init is only ever called from AnalyticsService.reconcile (@MainActor) — mark it @MainActor to match its actual call site. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@ final class AnalyticsService: ObservableObject {
|
||||
var healthByDate: [String: RawHealthDay] = [:] // HealthKit reference
|
||||
|
||||
init() {}
|
||||
init(vm: WorkoutViewModel) {
|
||||
@MainActor init(vm: WorkoutViewModel) {
|
||||
self.logByDate = Dictionary(vm.history.map { ($0.date, $0) }, uniquingKeysWith: { a, _ in a })
|
||||
self.workoutDates = Set(vm.workoutDates)
|
||||
self.scheduledWeekdays = Set(vm.schedule.keys)
|
||||
|
||||
Reference in New Issue
Block a user