From 436ec0120396567f57d1d550b7178ac605463f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Thu, 9 Apr 2026 17:47:19 +0200 Subject: [PATCH] Fix viewUpdateNSBG: re-declare lastBGTime local Restore `let lastBGTime = entries[latestEntryIndex].date` in viewUpdateNSBG. Dev currently fails to compile with "Cannot find 'lastBGTime' in scope" because two PRs that merged into dev on the same day textually did not conflict but semantically interfered: - #537 (Live Activity) added `Storage.shared.lastBgReadingTimeSeconds.value = lastBGTime` later in the function, relying on the existing local. - #565 (Display HIGH/LOW) removed the local declaration as part of an unrelated refactor; that branch was cut before #537 landed, so from its perspective the local was unused. Git's 3-way merge produced a syntactically clean file but the surviving reference now dangles. Re-adding the local is the minimal, intent-preserving fix. --- LoopFollow/Controllers/Nightscout/BGData.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/LoopFollow/Controllers/Nightscout/BGData.swift b/LoopFollow/Controllers/Nightscout/BGData.swift index ad1fb9ff..d97aba24 100644 --- a/LoopFollow/Controllers/Nightscout/BGData.swift +++ b/LoopFollow/Controllers/Nightscout/BGData.swift @@ -236,6 +236,7 @@ extension MainViewController { let latestBG = entries[latestEntryIndex].sgv let priorBG = entries[latestEntryIndex - 1].sgv let deltaBG = latestBG - priorBG + let lastBGTime = entries[latestEntryIndex].date self.updateServerText(with: sourceName)