WWDC24 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"


Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.