Skip to content

ForEach "soundSamples" logs console errors #2

@robnotyou

Description

@robnotyou

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(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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions