Fix navigation bar titles not displaying for Trio on iOS 26#92
Fix navigation bar titles not displaying for Trio on iOS 26#92MikePlante1 wants to merge 4 commits into
Conversation
Introduce View.uikitNavigationTitle(...) to ensure SwiftUI screens pushed within a UIKit UINavigationController have their navigationItem.title and largeTitleDisplayMode set correctly. Adds View+UIKitNavigationTitle.swift implementing a UIViewControllerRepresentable proxy that maps NavigationBarItem.TitleDisplayMode to UINavigationItem.LargeTitleDisplayMode and applies the title on the enclosing navigation controller's top view controller. Replace usages of .navigationTitle / .navigationBarTitleDisplayMode with .uikitNavigationTitle(...) across multiple PumpManagerUI views (BeepPreferenceSelectionView, NotificationSettingsView, PlayTestBeepsView, PodDetailsView, PodDiagnosticsView, PodKeepAliveView, PumpManagerDetailsView, ReadPodInfoView, ReadPodStatusView, SilencePodSelectionView) so titles display properly when hosted in UIKit flows.
Trio Test✅ I tested this on real hardware and it does fix the Trio Issue. What are we trying to solveWith Trio, if you tap on a pump icon from the main screen, the navigation headers are missing in some cases whereas going to that same screen using the Trio, Settings, Devices, Pump path, the navigation headers are shown as expected. TestThe table below indicates whether the navigation titles are visible when coming from Trio main screen before and with code from this PR applied.
|
Loop Test✅ Using this code in LoopWorkspace works as expected with no change in behavior (except for one improvement)
Repeat the Navigation Header test with LoopStart with update_dev_to_3.14.3, commit 29512d2 TestThe table below indicates whether the navigation titles are visible when coming from Loop main screen before and with code from this PR applied.
|
Problem
On iOS 26, SwiftUI's
.navigationTitleand.navigationBarTitleDisplayModeno longerpropagate to a hosting UIKit
UINavigationController's navigation bar. The Omnipod UI hostsall of its SwiftUI screens inside a UIKit coordinator (
OmniUICoordinator), so:prefersLargeTitles = true, screens that should be inlinerender with large titles.
Same root cause as MedtrumKit's jbr7rr/MedtrumKit#148.
Changes
Coordinator-pushed screens (setup flow + settings root)
The coordinator already sets
navigationItem.titledirectly for every screen it pushes, sothese display correctly on iOS 26. This removes the now-redundant
.navigationTitle/.navigationBarTitlemodifiers still lingering in those views, and fixes two latent titleissues that only surfaced once iOS 26 made the coordinator's value authoritative:
unlocalized "Low Reservoir Default").
NavigationLink-pushed settings sub-screens
These are created by SwiftUI when a
NavigationLinkis tapped, so the coordinator can't settheir titles. Added a
uikitNavigationTitle(_:displayMode:)helper that keeps the SwiftUImodifiers (which still work on iOS 17–25) and additionally sets
navigationItem.titleandlargeTitleDisplayModedirectly on the pushed view controller (for iOS 26). Applied to: PodDetails, Previous Pod, Notification Settings, Confidence Reminders, Silence Pod, Pod Keep
Alive, Diagnostics, Read Pod Status, Play Test Beeps, Read Pod Info, Pump Manager Details, and
Insulin Type.
Routing these through the coordinator (as MedtrumKit does for its screens) was deliberately
avoided: these views dismiss themselves via
presentationMode.dismiss(), which only worksinside SwiftUI navigation — a UIKit push would break their save/cancel auto-dismiss.
Insulin Type is a special case: its view (
InsulinTypeSetting) lives in LoopKitUI and setsno navigation title at all, so it was blank on every iOS version, not just 26. It's fixed
here from the OmnipodKit side by applying the helper at the
NavigationLinkdestination, withno change to shared LoopKitUI code.
Testing
🤖 Generated with Claude Code