Skip to content

Commit 09eade5

Browse files
committed
Use two rows if needed
1 parent b1bd86c commit 09eade5

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

LoopFollow/InfoTable/InfoTableView.swift

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,26 @@ struct InfoTableView: View {
2424
}
2525

2626
private func row(name: String, value: String) -> some View {
27-
HStack {
28-
Text(name)
29-
Spacer()
30-
Text(value)
31-
.foregroundStyle(.primary)
27+
ViewThatFits(in: .horizontal) {
28+
// Preferred: compact single line (label — value)
29+
HStack {
30+
Text(name)
31+
Spacer()
32+
Text(value)
33+
.foregroundStyle(.primary)
34+
}
35+
36+
// Fallback when the single line won't fit: label over value
37+
VStack(alignment: .leading, spacing: 0) {
38+
Text(name)
39+
Text(value)
40+
.foregroundStyle(.primary)
41+
.frame(maxWidth: .infinity, alignment: .trailing)
42+
}
3243
}
3344
.font(.system(size: fontSize))
34-
.frame(height: rowHeight)
45+
.lineLimit(1)
46+
.frame(minHeight: rowHeight)
3547
.listRowInsets(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8))
3648
}
3749
}

0 commit comments

Comments
 (0)