TabViewBottomAccessoryPlacement
A placement of the bottom accessory in a tab view. You can use this to adjust the content of the accessory view based on the placement.
Declaration
enum TabViewBottomAccessoryPlacementOverview
The following example shows playback controls when the view is inline, and an expanded slider player view when the view is expanded.
struct MusicPlaybackView: View {
@Environment(\.tabViewBottomAccessoryPlacement) var placement
var body: some View {
switch placement {
case .inline:
ControlsPlaybackView()
case .expanded:
SliderPlaybackView()
}
}You can set the TabView bottom accessory using tabViewBottomAccessory(content:)
TabView {
Tab("Home", systemImage: "house") {
HomeView()
}
Tab("Alerts", systemImage: "bell") {
AlertsView()
}
TabSection("Categories") {
Tab("Climate", systemImage: "fan") {
ClimateView()
}
Tab("Lights", systemImage: "lightbulb") {
LightsView()
}
}
}
.tabViewBottomAccessory {
HomeStatusView()
}