Post

Replies

Boosts

Views

Activity

Replacement for ToolbarItems with .bottomBar placement in iOS 26 TabView?
Prior to iOS 26, ToolbarItems with .bottomBar placement were convenient for tab-specific frequent actions. With iOS 26’s new tab layering now obscuring such ToolbarItems, it’s unclear whether .tabViewBottomAccessory is the intended replacement or if another pattern (like persistent floating buttons) is encouraged instead. What’s the recommended way to support quick, tab-specific actions under the new system? I’ve tried conditionally rendering a .tabViewBottomAccessory based on the active tab, but this causes a crash, which I’ve reported as FB18479195.
4
2
310
Jul ’25
Crash when conditionally rendering .tabViewBottomAccessory with TabView(selection:) in SwiftUI on iOS 26
Summary When using .tabViewBottomAccessory in SwiftUI and conditionally rendering it based on the selected tab, the app crashes with a NSInternalInconsistencyException related to _bottomAccessory.displayStyle. Steps to Reproduce Create a SwiftUI TabView using a @SceneStorage selectedTab binding. Render a .tabViewBottomAccessory with conditional visibility tied to selectedTab == .storage. Switch between tabs. Return to the tab that conditionally shows the accessory (e.g., “Storage”). Expected Behavior SwiftUI should correctly add, remove, or show/hide the bottom accessory view without crashing. Actual Behavior The app crashes with the following error: Environment iOS version: iOS 26 seed 2 (23A5276f) Xcode: 26 Swift: 6.2 Device: iPhone 12 Pro I have opened a bug report with the FB number: FB18479195 Code Sample import SwiftUI struct ContentView: View { enum TabContent: String { case storage case recipe case profile case addItem } @SceneStorage("selectedTab") private var selectedTab: TabContent = .storage var body: some View { TabView(selection: $selectedTab) { Tab( "Storage", systemImage: "refrigerator", value: TabContent.storage ) { StorageView() } Tab( "Cook", systemImage: "frying.pan", value: TabContent.recipe ) { RecipeView() } Tab( "Profile", systemImage: "person", value: TabContent.profile ) { ProfileView() } } .tabBarMinimizeBehavior(.onScrollDown) .tabViewBottomAccessory { if selectedTab == .storage { Button(action: { }) { Label("Add Item", systemImage: "plus") } } } } }
3
1
318
Jun ’25
.navigationTitle disappears when using .toolbar and List inside NavigationStack (iOS 26 beta)
.navigationTitle disappears when using .toolbar and List inside NavigationStack (iOS 26 beta) Summary In iOS 26 beta, using .navigationTitle() inside a NavigationStack fails to render the title when combined with a .toolbar and a List. The title initially appears as expected after launch, but disappears after a second state transition triggered by a button press. This regression does not occur in iOS 18. Steps to Reproduce Use the SwiftUI code sample below (see viewmodel and Reload button for state transitions). Run the app on an iOS 26 simulator (e.g., iPhone 16). On launch, the view starts in .loading state (shows a ProgressView). After 1 second, it transitions to .loaded and displays the title correctly. Tap the Reload button — this sets the state back to .loading, then switches it to .loaded again after 1 second. ❌ After this second transition to .loaded, the navigation title disappears and does not return. Actual Behavior The navigation title displays correctly after the initial launch transition from .loading → .loaded. However, after tapping the “Reload” button and transitioning .loading → .loaded a second time, the title no longer appears. This suggests a SwiftUI rendering/layout invalidation issue during state-driven view diffing involving .toolbar and List. Expected Behavior The navigation title “Loaded Data” should appear and remain visible every time the view is in .loaded state. ✅ GitHub Gist including Screen Recording 👉 View Gist with full details Sample Code import SwiftUI struct ContentView: View { private let vm = viewmodel() var body: some View { NavigationStack { VStack { switch vm.state { case .loading: ProgressView("Loading...") case .loaded: List { ItemList() } Button("Reload") { vm.state = .loading DispatchQueue.main.asyncAfter(deadline: .now() + 1) { vm.state = .loaded } } .navigationTitle("Loaded Data") } } .toolbar { ToolbarItem(placement: .navigationBarTrailing) { Menu { Text("hello") } label: { Image(systemName: "gearshape.fill") } } } } } } struct ItemList: View { var body: some View { Text("Item 1") Text("Item 2") Text("Item 3") } } @MainActor @Observable class viewmodel { enum State { case loading case loaded } var state: State = .loading init() { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { self.state = .loaded } } }
2
1
238
Jun ’25