ToolbarItem(placement: .topBarPinnedTrailing) is not shown if it is the only toolbar element.

If .topBarPinnedTrailing is used for the placement of a ToolbarItem, if this item is the only one in the toolbar then it is not displayed.

This .topBarPinnedTrailing appeared in iOS 27.0 to allow a button to be always visible in the toolbar if when there are overflows with many buttons in the toolbar. A toolbar button should always be visible, this behaviour is a bug.

It is a great issue on iPhone Duo which has less space for buttons in the toolbars, this attribute was designed to be sure the button using this attribute would always be visible. Bug is also there on Mac Catalyst and visionOS.

A feedback was created FB24882292

/// Shows a View with a toolbar with a .topBarPinnedTrailing button.
/// If the tool is the only one, it is not displayed. It is designed to be always visible, but it can be missing on the screen.
/// If there are one or more additional buttons, then the .topBarPinnedTrailing is well displayed.
///
/// Bug reproduced on iPhone 18 Pro Max simulator 27.0, iPhone Duo simulator iOS 27.1,
/// Mac Catalyst 27.0, Vision Pro simulator visionOS 27.0
/// > Warning : to test this ContentView, embed it in a NavigationStack.
struct ContentView: View {
    @State private var twoButtons = false
    var body: some View {
        VStack {
            Text("A toolbar should be always visible")
                .padding()
            Button {
                twoButtons.toggle()
            } label: {
                Text(twoButtons ? "Remove second tool" : "Add second tool")
            }
        }
        .toolbar {
            // ‼️ this button is missing if it is the only one.
            // ‼️ This is due to .topBarPinnedTrailing which makes it disappear if it is alone.
            ToolbarItem(placement: .topBarPinnedTrailing) {
                Button {
                    print("topBarPinnedTrailing pressed")
                }
                label: {
                    Label {
                        Text("topBarPinnedTrailing")
                    } icon: {
                        Image(systemName: "ladybug.fill")
                    }
                    .labelStyle(.iconOnly)
                }
            }
            if twoButtons {
                ToolbarItem(placement: .topBarTrailing) {
                    Button { //Barre d'icône ajouter une scène
                        print("topBarLeading pressed")
                        twoButtons = false
                    }
                    label: {
                        Label {
                            Text("topBarLeading")
                        } icon: {
                            Image(systemName: "minus")
                        }
                        .labelStyle(.iconOnly)
                    }
                }
            }
        }
    }
}

Thanks so much for the post.

I see you already filed a bug. You can see the status of your feedback in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identified fix, or has been resolved in another way. The status appears beside the label "Resolution." We're unable to share any updates on specific reports on the forums.

For more details on when you'll see updates to your report, please see What to expect after submission.

Running your code I see you hide the toolbar with be button?

Albert  WWDR

Thank you Albert. No I don't hide the toolbar with the "-" button, I just hide this button and the other button disappears too.

Imagine an Undo button. You do something and the Undo button appears. You click it, and as there is nothing more to Undo, the button disappears. Another use case is a button which appears only in some cases, but you have another button which should always stay on screen.

The issue only happens with the new .topBarPinnedTrailing modifier. You can try with the previous modifier and you will see that the first button stays on screen.

//            ToolbarItem(placement: .topBarPinnedTrailing) {
            ToolbarItem(placement: .topBarTrailing) {

Feel free if you have any questions. Thank you.

@lAppliEnRose Your issue has been routed to the correct engineering team for review of your submission. I will let them take over at this point. Please use the Feedback Assistant to communicate and address any inquiries regarding your project.

Thank you.

Albert  WWDR

ToolbarItem(placement: .topBarPinnedTrailing) is not shown if it is the only toolbar element.
 
 
Q