I want to do something similar to what's being done in the apps Photos and Podcasts in iOS 13.
Both of these apps have an extra view attached to the tab bar. In the Photos app it's a second row of navigation, like a sub menu and it's only present in one tab. In the Podcasts app it's a minified player and it's availble in all tabs.
What are my options for doing something like this when using SwiftUI? Is there a way to attach an extra view to the tab bar? Or should go with a ZStack inside each tabItem and duplicate my extra view within each ZStack?
You can use .overlay
modifier on the persist view
(TabBar, NavigationView, etc.) for example:
TabView { ,,, }
.overlay(
Rectangle()
.foregroundColor(.red)
.frame(width: 40, height: 40)
)
Of course with the correct configuration! This is just a demo to see how you can have a persistent view.
Also you can define your own custom modifier and apply it on the tabbar. The only thing matters here is to applying it on the persistent view
. So you don't need to duplicate your extra view within each view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With