Skip to content

Commit 6f8bde7

Browse files
committed
Scale info data table text with Dynamic Type
Drive the info table font size and row height from @ScaledMetric so the top-right info data grows and shrinks with the iPhone's text-size setting, keeping the existing 17pt/21pt look at the default size. Cap the scaling at accessibility1 so the compact top strip stays within its layout.
1 parent 52b0ccb commit 6f8bde7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

LoopFollow/InfoTable/InfoTableView.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ struct InfoTableView: View {
77
@ObservedObject var infoManager: InfoManager
88
var timeZoneOverride: String?
99

10+
@ScaledMetric(relativeTo: .body) private var fontSize: CGFloat = 17
11+
@ScaledMetric(relativeTo: .body) private var rowHeight: CGFloat = 21
12+
1013
var body: some View {
1114
List {
1215
if let tz = timeZoneOverride {
@@ -17,7 +20,7 @@ struct InfoTableView: View {
1720
}
1821
}
1922
.listStyle(.plain)
20-
.environment(\.defaultMinListRowHeight, 21)
23+
.environment(\.defaultMinListRowHeight, rowHeight)
2124
}
2225

2326
private func row(name: String, value: String) -> some View {
@@ -27,8 +30,8 @@ struct InfoTableView: View {
2730
Text(value)
2831
.foregroundStyle(.primary)
2932
}
30-
.font(.system(size: 17))
31-
.frame(height: 21)
33+
.font(.system(size: fontSize))
34+
.frame(height: rowHeight)
3235
.listRowInsets(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8))
3336
}
3437
}

LoopFollow/ViewControllers/MainHomeView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct MainHomeView: View {
4040

4141
if isNightscoutEnabled && !hideInfoTable.value {
4242
InfoTableView(infoManager: infoManager, timeZoneOverride: timeZoneOverride)
43+
.dynamicTypeSize(...DynamicTypeSize.accessibility1)
4344
.frame(minWidth: 160, maxWidth: 250)
4445
.overlay(
4546
Rectangle()

0 commit comments

Comments
 (0)