I have a main menu view that includes a navigation link. When I press "play," it navigates to the game screen and plays a sound. However, the sound only plays for a second and then cuts off for the rest of the navigation. I need help to make the sound continuously play into the next view. Thank you in advance for your assistance.
NavigationLink(destination: GameScreenView(), isActive: $presentSound) {
Button(action: {
// SoundManager.instance.playSound(sound: .impact)
DispatchQueue.main.asyncAfter(deadline: .now()) {
SoundManager.instance.playSound(sound: .impact)
// self.presentSound = true
}
}, label: {
Text("Play")
})
}