From 223da88949ffca95ab8893053ce47ca25d58a325 Mon Sep 17 00:00:00 2001 From: Bill Gestrich <3207996+gestrich@users.noreply.github.com> Date: Mon, 16 Mar 2026 19:31:57 -0400 Subject: [PATCH] Fix Xcode 26 layout issue in bolus and carb entry views Wrap amount text fields and unit labels in HStack to ensure the unit text lays out next to the amount. Xcode 26 broke this layout in both BolusInputView and CarbInputView. Co-Authored-By: Claude Sonnet 4.6 --- .../Views/Actions/BolusInputView.swift | 40 ++++++++-------- .../Views/Actions/CarbInputView.swift | 46 ++++++++++--------- 2 files changed, 47 insertions(+), 39 deletions(-) diff --git a/LoopCaregiver/LoopCaregiver/Views/Actions/BolusInputView.swift b/LoopCaregiver/LoopCaregiver/Views/Actions/BolusInputView.swift index c2ddf8c0..1cd85241 100644 --- a/LoopCaregiver/LoopCaregiver/Views/Actions/BolusInputView.swift +++ b/LoopCaregiver/LoopCaregiver/Views/Actions/BolusInputView.swift @@ -85,29 +85,33 @@ struct BolusInputView: View { Form { if let recommendedBolus = remoteDataSource.recommendedBolus { LabeledContent { - Text(LocalizationUtils.presentableStringFromBolusAmount(recommendedBolus)) - Text("U") - .frame(width: unitFrameWidth) + HStack { + Text(LocalizationUtils.presentableStringFromBolusAmount(recommendedBolus)) + Text("U") + .frame(width: unitFrameWidth) + } } label: { Text("Recommended Bolus") } } LabeledContent { - TextField( - "0", - text: $bolusAmount - ) - .multilineTextAlignment(.trailing) - .keyboardType(.decimalPad) - .focused($bolusInputViewIsFocused) - .onAppear(perform: { - bolusInputViewIsFocused = true - if let recommendedBolus = remoteDataSource.recommendedBolus { - bolusAmount = LocalizationUtils.presentableStringFromBolusAmount(recommendedBolus) - } - }) - Text("U") - .frame(width: unitFrameWidth) + HStack { + TextField( + "0", + text: $bolusAmount + ) + .multilineTextAlignment(.trailing) + .keyboardType(.decimalPad) + .focused($bolusInputViewIsFocused) + .onAppear(perform: { + bolusInputViewIsFocused = true + if let recommendedBolus = remoteDataSource.recommendedBolus { + bolusAmount = LocalizationUtils.presentableStringFromBolusAmount(recommendedBolus) + } + }) + Text("U") + .frame(width: unitFrameWidth) + } } label: { Text("Bolus") } diff --git a/LoopCaregiver/LoopCaregiver/Views/Actions/CarbInputView.swift b/LoopCaregiver/LoopCaregiver/Views/Actions/CarbInputView.swift index b2166b54..1b26ac94 100644 --- a/LoopCaregiver/LoopCaregiver/Views/Actions/CarbInputView.swift +++ b/LoopCaregiver/LoopCaregiver/Views/Actions/CarbInputView.swift @@ -90,18 +90,20 @@ struct CarbInputView: View { var carbEntryForm: some View { Form { LabeledContent { - TextField( - "0", - text: $carbInput - ) - .multilineTextAlignment(.trailing) - .keyboardType(.decimalPad) - .focused($carbInputViewIsFocused) - .onAppear(perform: { - carbInputViewIsFocused = true - }) - Text("g") - .frame(width: unitFrameWidth) + HStack { + TextField( + "0", + text: $carbInput + ) + .multilineTextAlignment(.trailing) + .keyboardType(.decimalPad) + .focused($carbInputViewIsFocused) + .onAppear(perform: { + carbInputViewIsFocused = true + }) + Text("g") + .frame(width: unitFrameWidth) + } } label: { Text("Amount Consumed") } @@ -210,15 +212,17 @@ struct CarbInputView: View { } LabeledContent { - TextField( - "", - text: $absorption - ) - .multilineTextAlignment(.trailing) - .keyboardType(.decimalPad) - .focused($absorptionInputFieldIsFocused) - Text("hr") - .frame(width: unitFrameWidth) + HStack { + TextField( + "", + text: $absorption + ) + .multilineTextAlignment(.trailing) + .keyboardType(.decimalPad) + .focused($absorptionInputFieldIsFocused) + Text("hr") + .frame(width: unitFrameWidth) + } } label: { Text("Absorption Time") }