I’m storing a heterogenous array of devices [Device] in an environment object. Now i want to iterate over it and have a different subview for each different struct (that implements the Device protocol) in the array.
I was able to get the above functionality by doing a type check with is and conditionally using different sub-views.
Now in my subview i am unable to bind a value from a downcasted device(for example in a slider).
Slider(value: (device as SpecialDevice).attribute)
There must be a better way to handle heterogenous arrays and downcasting in combination with two-way data binding, right?