title: SwiftUI: Better way of changing NavigationBarTitle based TabbedView label
body: <p>I was <em>finally</em> able to figure out how to change my <code>NavigationView</code>'s title based on the current tab in <code>TabbedView</code> using <code>onAppear()</code>, but I'm pretty sure that's not the way to go about it:</p>
  
  <pre><code>struct SomeTabbedView : View {
    @State private var selection = 0
    @State private var title = "First"
    var body: some View {
      NavigationView {
        TabbedView(selection: $selection) {
          ContentView()
            .tabItemLabel(
              Text("First")
            ).tag(0).onAppear{
              self.title = "First"
          }
  
          OtherView()
            .tabItemLabel(
              Text("Second")
            ).tag(1).onAppear{
              self.title = "Second"
            }
          }.navigationBarTitle(Text(title))
        }
      }
  }
  </code></pre>
  
  <p>In short, this violates the DRY principle pretty badly. If we decide to change the first view, for example, the string "First", the current implementation would require to repeat that in three different places.</p>
  
  <p>I thought of initializing an array of dictionaries and loop over <code>View: Label</code> pairs, but not only am I not sure it's the right way, I'm not sure how to proceed with implementing it. It is also possible to just have an array with labels, but that creates another violation in case we want to change the order of views.</p>