'tabViewBottomAccessory' leaves an empty accessory area when conditionally hidden

We use SwiftUI's .tabViewBottomAccessory in our iOS apps for displaying an Audio MiniPlayer View (like in the Apple Music App).

TabView(selection: $viewModel.selectedTab) {
    // Tabs here   
}
.tabViewBottomAccessory {
    if viewModel.showAudioMiniPlayer {
        MiniPlayerView()
    }
}

The Problem

This code works perfectly on iOS 26.0. When viewModel.showAudioMiniPlayer is false, the accessory is completely hidden.

However, on iOS 26.1 (23B5059e), when 'viewModel.showAudioMiniPlayer' becomes false, the MiniPlayerView disappears, but an empty container remains, leaving a blank space above the tab bar.

Is this a known Bug in iOS 26.1 and are there any effective workarounds?

Answered by DTS Engineer in 861715022

This is the intended behavior, at the moment there is no API that enables you programmatically hide the bottom accessory in a tab view. The tabview bottom accessory is still configured in this case, but it’s an empty view.

If you’d like the engineering team to add functionality that enables programmatically hiding the bottom accessory in the tab view, please submit an enhancement request via Feedback Assistant and post the Feedback ID number here.

You should probably raise this as a bug in the usual way. It won't really get progressed if it's only posted in these Developer Forums.

You need to raise each issue you find separately at https://feedbackassistant.apple.com/ You can post the FB numbers here if you want, so that others can link to them.

Accepted Answer

This is the intended behavior, at the moment there is no API that enables you programmatically hide the bottom accessory in a tab view. The tabview bottom accessory is still configured in this case, but it’s an empty view.

If you’d like the engineering team to add functionality that enables programmatically hiding the bottom accessory in the tab view, please submit an enhancement request via Feedback Assistant and post the Feedback ID number here.

Bug Report: FB20587621

Feedback Report: FB20603246

FB20772048

For those of you tempted to use a workaround like:

extension View {
    func apply<V: View>(@ViewBuilder _ block: (Self) -> V) -> V { block(self) }
}

TabView {
   // Some tabs
}
.apply {
    if viewModel.showAccessoryView {
        $0.tabViewBottomAccessory {
              MyAccessoryView()
         }
     } else { $0 }
}

It is not recommendable. It might look like it works initially but you may well see problems with the TabView and content being recreated when the condition changes. We tried it and it lead to deeper problems within the tab content view stack.

Hopefully as the DTS engineer mentioned the engineering team will consider adding an enhancement such as a hide parameter to the tabViewBottomAccessory modifier.

So as @andepopande pointed out above based on the first version of Xcode 26.2 beta we shall have a fix that seems backwards compatible with 26.1.

extension View {
    func apply<V: View>(@ViewBuilder _ block: (Self) -> V) -> V { block(self) }
}
 
TabView {
   // Some tabs
}
.apply {
	if #unavailable(iOS 26.1) {
	    // Previous approach that stopped working in iOS/iPadOS 26.1
		$0.tabViewBottomAccessory() {
			if viewModel.showAccessoryView {
				// accessory content
			} else {
				EmptyView()
			}
		}
	} else {
	    // When compiled with Xcode 26.2+ for iOS/iPadOS 26.1+
		$0.tabViewBottomAccessory(isEnabled: viewModel.showAccessoryView) {
			// accessory content
		}
	}
}

I have tested and so far not seen the deeper problems within the tab content view stack I reported above.

From further testing of the new version of the modifier with the isEnabled: parameter, whilst it compiles as backwards compatible with iOS 26.1, with that OS version it exhibits problems of being laggy to hide/show the accessory view and sometimes fails to render the view.

However, when running on iOS 26.2 the modifier is responsive and reliable. There seems to have been an overhaul of the implementation behind the tab bar view and its accessory view as evident in subtle differences with the behaviour of sub view content.

My testing was with builds created by Xcode 26.2 beta 1 so subsequent Xcode betas or the RC version might improve the 26.1 support.

'tabViewBottomAccessory' leaves an empty accessory area when conditionally hidden
 
 
Q