Skip to content

Replace UIKit SideNavigationController with pure SwiftUI side menu #3601

Description

@JoeMatt

Summary

Replace the UIKit-based SideNavigationController slide-out menu with a pure SwiftUI implementation. This is a prerequisite for eventually removing the legacy PVAppDelegatePVRootViewController UIKit hosting chain.

Current Architecture

The side menu uses a deep UIKit wrapping stack:

  1. PVAppDelegate creates PVRootViewController (UIViewController)
  2. Wraps in PVRootViewNavigationController (UINavigationController)
  3. Wraps in SideNavigationController (custom UIKit slide-out panel)
  4. SideMenuView (SwiftUI) is hosted inside via UIHostingController
  5. ConsolesWrapperView (SwiftUI) is main content, also in UIHostingController

The nav bar logo/header relies on a NavigationBarConfigurator (UIViewControllerRepresentable) that walks up the responder chain to find the UINavigationController and set the Provenance logo.

Proposed Changes

Phase 1: SwiftUI Side Menu Container

  • Replace SideNavigationController with a SwiftUI overlay/offset-based menu
  • Implement drag gesture to open/close (replaces UIKit pan gesture recognizers)
  • Orientation-aware width (70% portrait iPhone, 30-40% iPad/landscape)
  • Dimming overlay on main content when menu is open
  • Preserve gamepad support (menu toggle, shoulder buttons)

Phase 2: Remove UIKit Wrappers

  • Replace PVRootViewController with a SwiftUI root view
  • Replace PVRootViewNavigationController with NavigationStack
  • Move PVMenuDelegate / PVRootDelegate actions into SwiftUI environment or observable
  • Simplify PVAppDelegate.setupSwiftUIInterface()

Files to Modify/Delete

Delete (~6 files):

  • SideNavigationController/SideNavigationController.swift
  • SideNavigationController/SideNavigationController+NestedTypes.swift
  • SideNavigationController/UIViewController+SideNavigationController.swift
  • SideMenu/SideMenuNavigationController.swift (mostly commented out)
  • RootView/PVRootViewNavigationController.swift
  • SideMenu/NavigationBarConfigurator (embedded in SideMenuView.swift)

Rewrite (~4 files):

  • RootView/PVRootViewController.swift + extensions → SwiftUI root view
  • SideMenu/SideMenuView.swift — remove UIKit hosting, use native SwiftUI nav
  • App Delegate/PVAppDelegate.swift — simplify setupSwiftUIInterface()

Keep mostly unchanged:

  • ConsolesWrapperView.swift
  • MenuItemView.swift, MenuSectionHeaderView.swift
  • PVMenuDelegate.swift, PVRootDelegate.swift (protocols)

Platform Considerations

  • Must work on iOS and tvOS
  • tvOS has no edge pan gestures — menu opens via gamepad/remote button
  • iPad should support larger menu widths in regular size class

Context

The old SwiftUI-Introspect dependency was removed and replaced with NavigationBarConfigurator. This works but is fragile — a pure SwiftUI approach would eliminate the responder-chain walking entirely.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-workPR or issue being worked on by the AI agentenhancementimprovements, enhancements, new features, additions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions