Choppy minimized search bar animation

The new .searchToolbarBehavior(.minimized) modifier leads to a choppy animation both on device and SwiftUI canvas (iOS 26.2):

I assume this is not the intended behaviour (reported under FB21572657), but since I almost never receive any feedback to my reports, I wanted to see also here, whether you experience the same, or perhaps I use the modifier incorrectly?

struct SwiftUIView: View {
    
    @State var isSearchPresented: Bool = false
    @State var searchQuery: String = ""

    var body: some View {
        TabView {
            Tab {
                NavigationStack {
                    ScrollView {
                                Text(isSearchPresented.description)
                    }
                    .navigationTitle("Test")
                }
                .searchable(text: $searchQuery, isPresented: $isSearchPresented)
                .searchToolbarBehavior(.minimize) // **Choppy animation comes from here?**
            } label: {
                Label("Test", systemImage: "calendar")
            }
            
            Tab {
                Text("123")
            } label: {
                Label("123", systemImage: "globe")
            }
        }
    }
}

#Preview {
    if #available(iOS 26, *) {
        SwiftUIView()
    } else {
        // Fallback on earlier versions
    }
}

Thank you for bringing this issue to our attention. We have received the bug report FB21572657 and the correct team are investigating the animation causing the choppiness.

Please review your implementation of the .searchToolbarBehavior(.minimized) modifier. Ensure it is applied correctly within your view hierarchy and that there are no conflicting modifiers or animations that may be causing the choppiness. Currently, it appears that the modifier is set after another animation. If you remove that line, you can test whether the toolbar minimizes without the choppiness.

To isolate the issue, temporarily simplify the view in which you are applying this modifier. Remove other UI elements or animations and observe whether the choppiness persists. This will help determine if the issue is with the modifier itself or elsewhere in your view.

Temporarily remove the .searchable(text: $searchQuery, isPresented: $isSearchPresented) modifier for testing purposes.

Thanks

Albert Pascual
  Worldwide Developer Relations.

Dear @DTS Engineer,

Thank you for your reply and suggested way forward. I reduced the code to the minimum for further testing purposes:

struct SwiftUIView: View {
    @State var searchQuery: String = ""

    var body: some View {
        NavigationStack {
            ScrollView {
                Text("Test")
            }
            .navigationTitle("Test")
        }
        .searchable(text: $searchQuery)
        .searchToolbarBehavior(.minimize)
    }
}

#Preview {
    if #available(iOS 26, *) {
        TabView {
            Tab {
                SwiftUIView()
            } label: {
                Label("Test", systemImage: "calendar")
            }
        }
    } else {
        // Fallback on earlier versions
    }
}

I did not remove .searchable as per your suggestion since without it the .searchToolbarBehavior(.minimize) does not appear to have any effect (the search button is simply not shown).

The code above still leads to the same choppy animation as demonstrated in my initial message.

As further testing, I tried to extract the NavigationStack view to a separate view (similarly to here), and to remove ScrollView or replace it with a List, but to no success.

Hopefully this is helpful.

Thanks for the post.

Instead of examining the two distinct attributes that will trigger the animation, I should directly copy the code and test it myself. I'm a horrible human compiler and I should let Xcode do the work for me.

.searchable(text: $searchQuery)
 .searchToolbarBehavior(.minimize)

Upon using your code and utilizing the most recent released version of Xcode, I have not observed the choppy animation issue on my end. I would be grateful if you could provide the specific version of Xcode and simulator you are experiencing this problem with, as it could potentially be a bug.

Let’s get to the bottom of this!

Albert Pascual
  Worldwide Developer Relations.

Dear @DTS Engineer, thank you very much for your continued effort on this matter! Truly appreciate it! I use Xcode Version 26.2 (17C52) and experience this choppy animation in both SwiftUI Canvas and an actual device running iOS26.2.

At the same time, I would like to point out that the animation indeed runs smoothly when the TabView is commented out / not used at all (as perhaps in your code). It does not, however, when the TabView is used (as in my initial code).


#Preview {
    if #available(iOS 26, *) {
        TabView { // Does this cause a problem?
            Tab {
                SwiftUIView()
            } label: {
                Label("Test", systemImage: "calendar")
            }
        }
    } else {
        // Fallback on earlier versions
    }
}

Hopefully this helps to narrow down the source of the issue!

Choppy minimized search bar animation
 
 
Q