HomeiOS DevelopmentSwiftUI ToolbarItem borderless button has untappable padding areas

SwiftUI ToolbarItem borderless button has untappable padding areas


SwiftUI ToolbarItem: Button borders/padding seen however untappable

iOS 18+ / Xcode 26 – When utilizing ToolbarItem with a Button styled .borderedProminent, the button reveals borders/padding however these areas do not reply to faucets. Solely the precise heart contained in the crimson rectangle triggers the motion. How one can clear up this?

SwiftUI ToolbarItem borderless button has untappable padding areas

Code Instance

NavigationStack {
    ContentView()
        .toolbar {
            ToolbarItem(placement: .bottomBar) {
                Button("Save") {
                    print("Tapped!")
                }
                .buttonStyle(.borderedProminent)  // Drawback right here
                .border(Colour.crimson)         // RED BORDER VISIBLE
            }
        }
}

same code outside ToolbarItem

NavigationStack {
    Button("Save") {
       print("Tapped!")
    }
    .buttonStyle(.borderedProminent)
    .border(Colour.crimson)
}

Edit

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments