BLACK FRIDAY SALE: Save 50% on all my Swift books and bundles! >>

Frustrating autocomplete Xcode 15

Forums > SwiftUI

Before Xcode 15, when I started typing Button and selected Button(action:label:) from the menu and pressed enter twice, it changed to

Button {

} label: {


However, in Xcode 15, it now changes to:

Button(action: {}, label: {

Is there an option to revert to the 'old' completion behavior?


Try xcode settings up at the top left, key bindings. Might work.


The best thing I've found so far is to write:


and then go down one to Button(role:action:label:) and hit Return.

Then you'll find the ButtonRole? field highlighted. Just Delete (backspace) on that to remove it and Tab to highlight the Action? field and hit Enter. Then you'll have the setup you're looking for. It's pretty quick once muscle memory sets in.

When you hit Delete on ButtonRole? you'll end up with Button(role: , action: () -> Void , label: () -> View) but you don't have to clean up the 'role: ,' part. Just Tab to action and Enter.


Type in Xcode the Button you want to use

Button {

} label: {


Highlight the code

Go to Editor > Create code snippet

Change name to something meaniful EG My Button

Add placeholder in action by doing <#action#> and <#label#>

In Completion add btn

} label: {

so anytime you want a Button type btn and select "My Button"


Hacking with Swift is sponsored by Guardsquare

SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.

Learn more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.