Protocol

ButtonStyle

A type that applies standard interaction behavior and a custom appearance to all buttons within a view hierarchy.

Declaration

protocol ButtonStyle

Overview

To configure the current button style for a view hierarchy, use the buttonStyle(_:) modifier. Specify a style that conforms to ButtonStyle when creating a button that uses the standard button interaction behavior defined for each platform. To create a button with custom interaction behavior, use PrimitiveButtonStyle instead.

Topics

Implementing Buttons

func makeBody(configuration: Self.Configuration) -> Self.Body

Creates a view that represents the body of a button.

Required.

typealias ButtonStyle.Configuration

The properties of a button.

struct ButtonStyleConfiguration

The properties of a button.

Identifying Buttons

associatedtype Body

A view that represents the body of a button.

Required.

See Also

Applying Custom Button Styles

protocol PrimitiveButtonStyle

A type that applies custom interaction behavior and a custom appearance to all buttons within a view hierarchy.