One Logo Pool Ball
SwiftUI · IOS API REFERENCE

Alert.Button

struct · iOS 13.0+ · Deprecated in iOS 100000.0 · SDK 27.1

struct Button

A button representing an operation of an alert presentation.

Members (4)

static · iOS 13.0+ · Deprecated in iOS 100000.0

destructive

TypeScript
static destructive(label: _SwiftUICore_Text, action?: ((() => void)) | null): Alert_Button
Swift declaration
static func destructive(_ label: Text, action: (() -> Void)? = {}) -> Alert.Button

Creates an alert button with a style that indicates a destructive action. - Parameters: - label: The text to display on the button. - action: A closure to execute when the user taps or presses the button. - Returns: An alert button that indicates a destructive action.

static · iOS 13.0+ · Deprecated in iOS 100000.0

cancel

TypeScript
static cancelAction(label: _SwiftUICore_Text, action?: ((() => void)) | null): Alert_Button
Swift declaration
static func cancel(_ label: Text, action: (() -> Void)? = {}) -> Alert.Button

Creates an alert button that indicates cancellation, with a custom label. - Parameters: - label: The text to display on the button. - action: A closure to execute when the user taps or presses the button. - Returns: An alert button that indicates cancellation.

static · iOS 13.0+ · Deprecated in iOS 100000.0

cancel

TypeScript
static cancel(action?: ((() => void)) | null): Alert_Button
Swift declaration
static func cancel(_ action: (() -> Void)? = {}) -> Alert.Button

Creates an alert button that indicates cancellation, with a system-provided label. The system automatically chooses locale-appropriate text for the button's label. - Parameter action: A closure to execute when the user taps or presses the button. - Returns: An alert button that indicates cancellation.

static · iOS 13.0+ · Deprecated in iOS 100000.0

default

TypeScript
static default(label: _SwiftUICore_Text, action?: ((() => void)) | null): Alert_Button
Swift declaration
static func `default`(_ label: Text, action: (() -> Void)? = {}) -> Alert.Button

Creates an alert button with the default style. - Parameters: - label: The text to display on the button. - action: A closure to execute when the user taps or presses the button. - Returns: An alert button with the default style.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →