We use SwiftUI’s tabViewBottomAccessory
in our iOS apps for displaying an Audio MiniPlayer View (like within the Apple Music App).
TabView(choice: $viewModel.selectedTab) {
// Tabs right here
}
.tabViewBottomAccessory {
if viewModel.showAudioMiniPlayer {
MiniPlayerView()
}
}
We now have a number of customers reporting, that they will continuously see an empty tabViewBottomAccessory
(although viewModel.showAudioMiniPlayer
is false
). We can not reproduce this ourselves. Thus far, we will solely reproduce this by wrapping it in a ZStack
:
.tabViewBottomAccessory {
ZStack {
if viewModel.showAudioMiniPlayer {
MiniPlayerView()
}
}
Is that this a SwiftUI bug? How can we repair it?
What we now have tried to date:
- Wrapping the whole view in an if-else. Nevertheless this results in the whole view being re-rendered each time
viewModel.showAudioMiniPlayer
adjustments. This isn’t an choice.