Skip to content

Add UIKit navigation title helper#33

Draft
MikePlante1 wants to merge 2 commits into
LoopKit:mainfrom
MikePlante1:fix/nav-titles
Draft

Add UIKit navigation title helper#33
MikePlante1 wants to merge 2 commits into
LoopKit:mainfrom
MikePlante1:fix/nav-titles

Conversation

@MikePlante1

Copy link
Copy Markdown
Contributor

Summary

On iOS 26, SwiftUI's .navigationTitle no longer bridges to a parent UIKit
UINavigationController. MinimedKit hosts its SwiftUI settings screens inside
MinimedUICoordinator (a UINavigationController) via DismissibleHostingController,
so the navigation bar titles on the NavigationLink-pushed settings sub-screens
render 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 26
no longer forwards to the hosting navigation controller's bar. The root settings screen
was unaffected because MinimedUICoordinator already sets navigationItem.title
directly — only the sub-screens it doesn't construct were broken.

Changes

  • Add View.uikitNavigationTitle(_:displayMode:) helper
    (MinimedKitUI/Views/View+UIKitNavigationTitle.swift). It applies the SwiftUI
    modifiers (for < iOS 26) plus a hidden UIViewControllerRepresentable that sets
    navigationItem.title and largeTitleDisplayMode on the navigation controller's
    top view controller.
  • Apply the helper to the four settings sub-screens (all displayMode: .inline):
    • BatteryTypeSelectionView
    • DataSourceSelectionView
    • UseMySentrySelectionView
    • InsulinTypeSetting — wrapped at its NavigationLink in MinimedPumpSettingsView
  • Wire the new helper file into the MinimedKitUI target in project.pbxproj
    (MinimedKit uses explicit file references, not synchronized file groups).

Note on InsulinTypeSetting

InsulinTypeSetting (LoopKitUI) sets no navigation title at all, so its title was
blank on every iOS version, not just 26. Wrapping the NavigationLink destination
fixes it here without modifying LoopKitUI.

Why keep the NavigationLink (vs. pushing via the coordinator)

These selection screens dismiss via presentationMode.wrappedValue.dismiss(), which
only works within SwiftUI navigation. Converting them to manual pushViewController
calls would break Save/Cancel auto-dismiss. The helper keeps the NavigationLink
intact 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

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.
@ps2

ps2 commented Jun 24, 2026

Copy link
Copy Markdown
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?

@MikePlante1

Copy link
Copy Markdown
Contributor Author

Looks like the only navigation title that's broken for Loop is Insulin Type for iOS 26 and 18, but all of the corrected views are broken in Trio since its UI is setup differently. This PR has been tested against Loop's latest main for iOS 26.5 and 18.6.

@MikePlante1 MikePlante1 marked this pull request as draft June 25, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants