Post

Replies

Boosts

Views

Activity

IOS 18 update causes toolbar contents to not show
I have an app with a TabView containing a view representable containing a SwiftUI View with a toolbar. The representable is providing the toolbar while the .toolbar modifier provides the content. Everything works normally on iOS 17, but on iOS 18 the toolbar contents are not showing. Is this a iOS 18 bug? See the code below for a simplified example. import SwiftUI @main struct TestApp: App { @State var selection: String = "one" var body: some Scene { WindowGroup { TabView(selection: $selection) { Representable() .tabItem { Text("One") } .tag("one") } } } } struct Representable: UIViewControllerRepresentable { let navigationController = UINavigationController() func makeUIViewController(context: Context) -> UINavigationController { navigationController.pushViewController(UIHostingController(rootView: ToolbarView()), animated: false) return navigationController } func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {} } struct ToolbarView: View { var body: some View { NavigationLink("Navigate") { ToolbarView() } .toolbar { ToolbarItem(placement: .principal) { Text("Top") } } } }
9
5
1.1k
Aug ’24