HomeiOS DevelopmentiOS 26 SwiftUI Liquid Glass toolbar animation solely performs when switching state...

iOS 26 SwiftUI Liquid Glass toolbar animation solely performs when switching state quickly


I’m testing the iOS 26 Liquid Glass toolbar habits in SwiftUI. Toolbars have a morphing/materialize animation when their content material adjustments throughout navigation.

In my case, I’m switching toolbar gadgets utilizing a segmented Picker (not navigation). The toolbar contents do change, however the Liquid Glass animation solely performs if I swap tabs in a short time. If I swap usually, the toolbar updates immediately with no animation.

Repro code

struct ContentView: View {

    @State non-public var tab: Tabs = .tab1

    var physique: some View {
        NavigationStack {
            ZStack {
                swap tab {
                case .tab1:
                    Textual content("Tab 1")
                        .toolbar {
                            ToolbarItem(placement: .topBarLeading) {
                                Button("Tab 1 Button", systemImage: "particular person") { }
                            }
                        }

                case .tab2:
                    Textual content("Tab 2")
                        .toolbar {
                            ToolbarItem(placement: .topBarLeading) {
                                Button("Tab 2 Button", systemImage: "plus") { }
                            }
                            ToolbarItem(placement: .topBarLeading) {
                                Button("Tab 2 Button", systemImage: "trash") { }
                            }
                        }
                }
            }
            .animation(.default, worth: tab)
            .navigationTitle("Testing Toolbar")
            .toolbarTitleDisplayMode(.inline)
            .safeAreaBar(edge: .prime) {
                Picker("Picker", choice: $tab) {
                    Textual content("Tab 1").tag(Tabs.tab1)
                    Textual content("Tab 2").tag(Tabs.tab2)
                }
                .pickerStyle(.segmented)
            }
        }
    }

    enum Tabs {
        case tab1
        case tab2
    }
}

Habits

  • Switching tabs usually → toolbar adjustments with out Liquid Glass animation

iOS 26 SwiftUI Liquid Glass toolbar animation solely performs when switching state quickly

  • Switching tabs quickly → Liquid Glass morph animation does play

test2

Query

Is there a method to power the Liquid Glass animation when toolbar gadgets change as a result of state updates (like a segmented picker)?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments