How To Change/Specify Custom View In Other areas Of the View for Every Child View Change In SwiftUI

Hi. Beginner here. Currently this is how my app looks like. What I wish to do is for every view that gets changed highlighted by the green square border, the menu item in the top horizontal HStack (my so called toolbar) also changes (highlighted in yellow circle).

Currently, I use an ObservedObservable to change the view (green square) via the sidebarmenu.

What is the best approach to the toolbar part? I was thinking that maybe within the child view e.g. SampleMap1, it has a custom menu item view variable which will be shown in the parent view (Where the yellow circle is lcoated) to add the menu item view. But I am not sure how to go about it.

Advise, suggestions appreciated. Thoughts?

These are what i have so far ...

struct MainContent: View {
  @ObservedObject var navigationManager : SidebarNavigationManager
   
  var body: some View {
    VStack(spacing: 0) {
      switch navigationManager.menuCategory {
        case .SAMPLE1:
          SampleMap1()
        case .SAMPLE2:
          SampleMap2()
      }
    }
    .navigationBarTitleDisplayMode(.inline)
  }
}

And content view looks like this ...

struct ContentView: View {
  @StateObject var navigationManager = SidebarNavigationManager()
   @State var show = false

  var body: some View {
    NavigationView {
      ZStack(alignment: .leading) {
        VStack(spacing: 0) {
          HStack {
            Button(action: {
              withAnimation(.default) {
                show.toggle()
              }
            }) {
              Image(systemName: "line.3.horizontal")
            }
            Spacer()
            Text("Home")
            Spacer()
            // This is where I wish to put like 2 or 3 menu items, default hidden and will show when the child view provides a menu item view with it that will get shown here
            OverflowMenu() <-- ordinary view
          }
          .padding()
          .foregroundColor(.primary)
          .overlay(Rectangle().stroke(Color.primary.opacity(0.1), lineWidth: 1).shadow(radius: 3).edgesIgnoringSafeArea(.top))
           
          MainContent(navigationManager: navigationManager)
            .frame(maxWidth: .infinity, maxHeight: .infinity)
        }
        HStack {
          SideMenuView(show: $show, navigationManager: navigationManager)
            .offset(x: self.show ? 0 : -UIScreen.main.bounds.width / 1.2)
          Spacer(minLength: 0)
          Rectangle().stroke(.clear).frame(width: show ? UIScreen.main.bounds.width - (UIScreen.main.bounds.width / 1.2) : 0)
            .contentShape(Rectangle())
            .onTapGesture {
              if (show) {
                withAnimation(.default) {
                  show.toggle()
                }
              }
            }
        }
      }
      .navigationBarHidden(true)
    }
    .navigationViewStyle(.stack)
  }
}

struct SampleText : View {
  let text: String
   
  var body: some View {
    Text(text)
  }
}

I am merely collecting information if it can be done and if yes, how. Currently I am using an EnvironmentObject to pass data settings to make the view visible or not. I am wondering if my post question is possible as this would offer more flexibility with passing views

How To Change/Specify Custom View In Other areas Of the View for Every Child View Change In SwiftUI
 
 
Q