Binding a List to one of two @Published arrays

I have an environment object with two arrays of the same type, each array is @Published

In a View I want to show a list of one or the other array in a List, which array is chosen is set on showing the View

How do I tell the View which array to show?
Code Block
@EnvironmentObject var model: Model
Code Block
var body: some View
{
List
{
ForEach(model.a.indices)
{ index in
ThingView( rowData: self.$model.a[index] )
}
}
}


Model contains:
Code Block
@Published var a: [String]
@Published var b: [String]

I want to pick "a" or "b" when the view is shown, do I use @State or a @Binding or what?
It is not clear enough what you mean by set on showing the View or when the view is shown.

Do you want to set it in the initializer of the View? Or are you expecting some sort of events so called showing the View will happen and set it in that event?
I will be showing two Views, one for each of the published arrays, but its the same View definition. How do I initialize the View to tell it which of the two arrays to show but still have it be bound?
I used an @State var enum and used that with a ternary to pick one array or the other. Not sure that's the best idea. Doesn't scale well beyond 2 choices.
Seems you can solve your issue by yourself. Good luck.
Binding a List to one of two @Published arrays
 
 
Q