From 98eaa9fb27619988d4fbc89bdf278a639f6c6724 Mon Sep 17 00:00:00 2001 From: kutesir Date: Fri, 29 May 2026 13:38:52 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20reduce=20memory=20footprint=20=E2=80=94?= =?UTF-8?q?=20Canvas=20for=20dot=20grid,=20scope=20PreferenceKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DotGridProgress replaced GeometryReader + 200+ Circle view nodes with a single Canvas draw call. Canvas receives its own size parameter so no GeometryReader is needed; SwiftUI interpolates the progress value through the .animation modifier for smooth fill transitions. FloatingTabState ScrollYKey made private to TabBarScrollModifier to limit its PreferenceKey scope and prevent unintended propagation across unrelated subtrees. --- KisaniCal/Views/TodayView.swift | 46 +++++++++++++-------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/KisaniCal/Views/TodayView.swift b/KisaniCal/Views/TodayView.swift index 4370e1b..311d0a5 100644 --- a/KisaniCal/Views/TodayView.swift +++ b/KisaniCal/Views/TodayView.swift @@ -1107,39 +1107,29 @@ struct DotGridProgress: View { private let rows = 7 var body: some View { - GeometryReader { geo in - let cols = max(1, Int((geo.size.width + gap) / (dotSize + gap))) + Canvas { ctx, size in + let step = dotSize + gap + let cols = max(1, Int((size.width + gap) / step)) let total = cols * rows let filled = Int(Double(total) * min(max(progress, 0), 1)) - VStack(alignment: .leading, spacing: gap) { - ForEach(0..