Add UIKit navigation title helper#33
Draft
MikePlante1 wants to merge 2 commits into
Draft
Conversation
Introduce View.uikitNavigationTitle helper (View+UIKitNavigationTitle.swift) to set navigationItem.title and largeTitleDisplayMode when SwiftUI screens are hosted inside a UIKit UINavigationController. Replace .navigationTitle usages with .uikitNavigationTitle(displayMode: .inline) in BatteryTypeSelectionView, DataSourceSelectionView, UseMySentrySelectionView, and the InsulinTypeSetting destination; update the Xcode project to include the new source file.
Contributor
|
I'm not seeing this behavior on my phone running iOS 26 and Medtronic on Loop. Can you provide steps to reproduce, and/or screenshots of what you're seeing? |
Contributor
Author
|
Looks like the only navigation title that's broken for Loop is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On iOS 26, SwiftUI's
.navigationTitleno longer bridges to a parent UIKitUINavigationController. MinimedKit hosts its SwiftUI settings screens insideMinimedUICoordinator(aUINavigationController) viaDismissibleHostingController,so the navigation bar titles on the
NavigationLink-pushed settings sub-screensrender blank on iOS 26.
This is the same regression and fix already applied to MedtrumKit and PR'd to OmnipodKit.
Root cause
The pushed SwiftUI screens set their title with
.navigationTitle(...), which iOS 26no longer forwards to the hosting navigation controller's bar. The root settings screen
was unaffected because
MinimedUICoordinatoralready setsnavigationItem.titledirectly — only the sub-screens it doesn't construct were broken.
Changes
View.uikitNavigationTitle(_:displayMode:)helper(
MinimedKitUI/Views/View+UIKitNavigationTitle.swift). It applies the SwiftUImodifiers (for < iOS 26) plus a hidden
UIViewControllerRepresentablethat setsnavigationItem.titleandlargeTitleDisplayModeon the navigation controller'stop view controller.
displayMode: .inline):BatteryTypeSelectionViewDataSourceSelectionViewUseMySentrySelectionViewInsulinTypeSetting— wrapped at itsNavigationLinkinMinimedPumpSettingsViewMinimedKitUItarget inproject.pbxproj(MinimedKit uses explicit file references, not synchronized file groups).
Note on
InsulinTypeSettingInsulinTypeSetting(LoopKitUI) sets no navigation title at all, so its title wasblank on every iOS version, not just 26. Wrapping the
NavigationLinkdestinationfixes it here without modifying LoopKitUI.
Why keep the
NavigationLink(vs. pushing via the coordinator)These selection screens dismiss via
presentationMode.wrappedValue.dismiss(), whichonly works within SwiftUI navigation. Converting them to manual
pushViewControllercalls would break Save/Cancel auto-dismiss. The helper keeps the
NavigationLinkintact and fixes only the title.
Testing
Verified in Trio via Xcode 26.5 to iPhone simulators (17 Pro iOS 26.5, 14 Plus iOS 18.6)
🤖 Generated with Claude Code