Open robnotyou opened 2 years ago
In Xcode 14, I get repeated console errors:
ForEach<Array<Float>, Float, BarView>: the ID -47.630486 occurs multiple times within the collection, this will give undefined results!
This is caused by an issue with the ForEach...
ForEach
ForEach(mic.soundSamples, id: \.self) { level in BarView(value: self.normalizeSoundLevel(level: CGFloat(level))) }
...because soundSamples are not Identifiable (since each level can occur many times)
soundSamples
Identifiable
I was able to fix this issue by using:
ForEach(mic.soundSamples.indices, id: \.self) { i in BarView(value: self.normalizeSoundLevel(level: CGFloat(mic.soundSamples[i]))) }
In Xcode 14, I get repeated console errors:
This is caused by an issue with the
ForEach
......because
soundSamples
are notIdentifiable
(since each level can occur many times)