Waveform
Waveform copied to clipboard
Fatal error: Index out of range on setting the `selectedSamples`
Hey 👋🏻 I'm getting Fatal error: Index out of range
exception on setting the selectedSamples
range like so:
Waveform(
generator: generator,
selectedSamples: $selectedSamples,
selectionEnabled: .constant(true)
)
.foregroundColor(.white)
.onAppear {
selectedSamples = 0 ..< Int(generator.audioBuffer.frameLength)
}
What could be the issue?
Hey @heyaibek, did you manage to figure this one out?
Hey @pixlwave 👋🏻 I've noticed that the crash happens when selection is enabled by constant value like selectionEnabled: .constant(true)
. In your demo project, however, it depends on the toggle value to enable/disable the selection. So, I just put the same mechanism in my code. But I'm afraid that this bug should be fixed 😛