title: ForEach two arrays - simple solution possible?
body: <p>I'm struggling with a simple solution I can't find. I want to build a picker which shows the flags and selects the Language code from the other array. There must be a simple solution. so long I helped myself with this ugly <code>onChange</code> crutch.</p>
  <p>Any suggestions?</p>
  <pre><code>struct LanguageView: View {
      
      @AppStorage (&quot;language&quot;)var language: String = &quot;de&quot;
      @State private var flag: String = &quot;&quot;
      var languages = [&quot;de&quot;, &quot;en&quot;, &quot;pl&quot;]
      var languageFlags = [&quot;&quot;, &quot; &quot;, &quot;&quot; ]
      
      var body: some View {
          
          VStack{
              
              HStack{
                  
                  Picker(&quot;&quot;, selection: $flag) {
                      ForEach(languageFlags, id: \.self) {
                          Text($0)
                              .font(.caption2)       
                      }
                      
                  }
                  .pickerStyle(SegmentedPickerStyle())
                  
              }.onChange(of: flag, perform: { value in
                  if flag == &quot;&quot; {language = &quot;de&quot;}
                  if flag == &quot; &quot; {language = &quot;en&quot;}
                  if flag == &quot;&quot; {language = &quot;pl&quot;}
              })
          }
          
          .environment(\.locale, .init(identifier: language))
      }
  }
  </code></pre>