From 708bf95e2a83828035a221459d95270ed039ca4f Mon Sep 17 00:00:00 2001 From: kutesir Date: Wed, 8 Jul 2026 10:46:25 +0300 Subject: [PATCH] fix(healthkit): use let for interval captured across async let tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build error (Xcode, Swift 6): 'interval' was a var built via two statements then captured by 3 concurrent async let tasks in dailyReference — Swift 6 requires captured values to be immutable. It was never mutated after setup; switched to a single-expression let (DateComponents(day: 1)). Co-Authored-By: Claude Opus 4.8 --- KisaniCal/Managers/HealthKitManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KisaniCal/Managers/HealthKitManager.swift b/KisaniCal/Managers/HealthKitManager.swift index 8ab8332..7ef94f7 100644 --- a/KisaniCal/Managers/HealthKitManager.swift +++ b/KisaniCal/Managers/HealthKitManager.swift @@ -168,7 +168,7 @@ final class HealthKitManager: ObservableObject { func dailyReference(from start: Date, to end: Date) async -> [String: (steps: Int?, calories: Int?, restingHR: Int?)] { guard authorized, isAvailable else { return [:] } let anchor = Calendar.current.startOfDay(for: start) - var interval = DateComponents(); interval.day = 1 + let interval = DateComponents(day: 1) async let steps = statsCollection(.stepCount, unit: .count(), options: .cumulativeSum, anchor: anchor, end: end, interval: interval) async let cals = statsCollection(.activeEnergyBurned, unit: .kilocalorie(), options: .cumulativeSum, anchor: anchor, end: end, interval: interval)