Skip to content

Commit

Permalink
nav titles update on tabs now
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattiello <[email protected]>
  • Loading branch information
JoeMatt committed Nov 16, 2024
1 parent 17d1a64 commit aaeea5e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions PVUI/Sources/PVSwiftUI/RootView/PVRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ public class PVRootViewController: UIViewController, GameLaunchingViewController
let consolesView = ConsolesWrapperView(consolesWrapperViewDelegate: consolesWrapperViewDelegate, viewModel: self.viewModel, rootDelegate: self)
loadIntoContainer(.home, newVC: UIHostingController(rootView: consolesView))

// Add observer for title updates
selectedTabCancellable = consolesWrapperViewDelegate.$selectedTab
.receive(on: DispatchQueue.main)
.sink { [weak self] selectedTab in
guard let self = self else { return }
if selectedTab == "home" {
self.navigationItem.title = "Home"
} else if let console = self.gameLibrary.system(identifier: selectedTab) {
self.navigationItem.title = console.name
}
}

if let console = gameLibrary.activeSystems.first {
consolesWrapperViewDelegate.selectedTab = console.identifier
} else {
Expand Down

0 comments on commit aaeea5e

Please sign in to comment.