Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

iOS26 beta ToolbarItem with placement to principal width is not fill to screen

I’m trying to add a TextField to the toolbar using .principal placement, and I want it to either fill the screen width or expand based on the surrounding content. However, it’s not resizing as expected — the TextField only resizes correctly when I provide a hardcoded width value. This behavior was working fine in previous versions of Xcode, but seems to be broken in Xcode 26. Not sure if this is an intentional change or a bug. i am using iOS26 beta and Xcode 26 beta

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
        .toolbar {
            ToolbarItem(placement: .principal) {
                HStack {
                    TextField("Search", text: .constant(""))
                        .textFieldStyle(.roundedBorder)
                        .frame(maxWidth: .infinity)
//                        .frame(width: 300)
                    Button("cancel") {
                        
                    }
                }
                .frame(maxWidth: .infinity)
            }
        }
    }
}

#Preview {
    NavigationView {
        ContentView()
    }
}
iOS26 beta ToolbarItem with placement to principal width is not fill to screen
 
 
Q