Structure

DefaultButtonStyle

The default button style, based on the button’s context.

Declaration

struct DefaultButtonStyle

Overview

If you create a button directly on a blank canvas, the style varies by platform. iOS uses the borderless button style by default, whereas macOS, tvOS, and watchOS use the bordered button style.

If you create a button inside a container, like a List, the style resolves to the recommended style for buttons inside that container for that specific platform.

You can override a button’s style. To apply the default style to a button, or to a view that contains buttons, use the buttonStyle(_:) modifier.

Topics

Creating a Default Button Style

init()

Creates a default button style.

Rendering a Button

func makeBody(configuration: DefaultButtonStyle.Configuration) -> View

Creates a view that represents the body of a button.

typealias DefaultButtonStyle.Body

A view that represents the body of a button with the default button style.

Relationships

See Also

Applying Standard Button Styles

struct PlainButtonStyle

A button style that doesn’t style or decorate its content while idle, but may apply a visual effect to indicate the pressed, focused, or enabled state of the button.

struct LinkButtonStyle

A button style for buttons that emulate links.

struct BorderedButtonStyle

A button style that applies standard border artwork based on the button’s context.

struct BorderlessButtonStyle

A button style that doesn’t apply a border.