I'm trying to add a brand logo to a SwiftUI tvOS interface. The main UI is a TabView
. Focus works fine until I try to add a ToolbarItem
. Once I do that it seems to steal focus and my TabView
becomes unusable. Here's a simple example that demonstrates the problem:
struct TestView: View {
var body: some View {
NavigationView {
TabView {
Text("Screen One")
.tabItem({ Text("One") })
Text("Screen Two")
.tabItem({ Text("Two") })
Text("Screen Three")
.tabItem({ Text("Three") })
}
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Image(systemName: "house.fill")
}
}
}
}
}
How can I keep focus from getting messed up? Should I not be using the toolbar to add the logo?
It looks like just adding toolbar
causes a UINavigationBar
to be drawn on top of the tab bar, which is why it isn't getting focus. Still not sure how to fix it though...