Skip to content

In development. This website is being rebuilt. Content, screenshots, and links may still change.

Martin SchulzeiOS Developer

Demos

SwiftUI Button Builder

You put a button together. The preview is roughly how it looks on iOS, and the Swift below is what you paste into the project. Anything left at the default stays out of the code.

SF Symbol

Button(_:systemImage:action:) is available on iOS 14.

The drawings are original, not Apple symbols. The names are real.

Style

plain and borderless need iOS 13. bordered and borderedProminent need iOS 15.

Size

regular is omitted. extraLarge needs iOS 17 and is the same height as large on iPhone and iPad.

Shape

automatic is omitted. The shape shows on bordered and borderedProminent. Otherwise the controls are off. circle needs iOS 17.

Tint

With no tint, .tint is omitted. The preview uses blue, unless the role is .destructive.

Font weight

regular is omitted. .fontWeight needs iOS 16.

Also
Role

.destructive turns the button red. iOS 15.

Preview

Preview appearance

Requires iOS 15

Generated code

This compiles as written. Replace // action with the action. Modifiers left at the default are not in the code.

Swift
Button("Save", systemImage: "star.fill") {
    // action
}
.buttonStyle(.borderedProminent)
.controlSize(.large)
.buttonBorderShape(.capsule)
.tint(.orange)

What the modifiers do

Label

The text is the title. With no symbol, Button("Save") is enough. An empty field uses that same placeholder in the code. The title describes the action, including for VoiceOver, and it stays in the code when you show only the symbol.

SF Symbol

With a symbol the builder writes Button("Save", systemImage: "star.fill"). That initializer is iOS 14, not iOS 17. Icon only, with no visible title: .labelStyle(.iconOnly), also iOS 14. The title stays as the VoiceOver name. The drawings in the preview are original, not Apple symbols.

Full width

.frame(maxWidth: .infinity) has to sit on the label inside the button. On the button itself the fill does not stretch. The builder switches to the label: form. That label is Text without a symbol, and Label with one.

Style

.borderedProminent fills the button with the tint and puts white text on it. .bordered puts a gray fill behind tinted text. .borderless is tinted text only, and .plain is the normal foreground color. plain and borderless are iOS 13. bordered and borderedProminent are iOS 15. iOS 26 also has .glass and .glassProminent. This builder does not write those.

Size

.controlSize is iOS 15. .regular is the default and is left out of the code. .extraLarge is iOS 17. On iPhone and iPad it resolves to .large. It is taller on visionOS. The preview uses the same height as large.

Shape

.buttonBorderShape draws the platter of bordered and borderedProminent. plain and borderless leave the shape invisible, turn the controls off, and the builder omits .buttonBorderShape. .automatic leaves the shape to the system. On current iOS that is a capsule, so the preview matches .capsule. automatic is left out of the code. capsule, roundedRectangle, and roundedRectangle(radius:) are iOS 15. .circle is iOS 17.

Tint

.tint is iOS 15 and sets the accent color on this button. With no tint, the preview uses system blue and the modifier is left out. With .destructive, the preview stays red even when you set a tint. Apple’s documentation does not say whether the system lays that tint over the red. The builder still writes both the role and the tint.

Font weight

.fontWeight is iOS 16. .regular is the default and is left out.

Role

Button("Delete", role: .destructive) marks a destructive action, on iOS 15. The button turns red: filled for borderedProminent, as the text for bordered and borderless. With a symbol it is Button("Delete", systemImage: "trash", role: .destructive). plain keeps the foreground color.

What gets left out

The builder omits whatever matches the default: size regular, shape automatic, no tint, font weight regular, no role, no symbol, no full width. plain and borderless omit the shape entirely. It always writes the style, because none of the four is the automatic default.

Which iOS version

The version is the oldest one where that call compiles, according to Apple’s documentation. The note above the preview uses the maximum of what you picked.