name thatuiuser interface

Empty the Trash?

You can’t undo this action.

Tick “Don’t ask me again” — that checkbox is NSAlert’s suppression button

Alert

/ NSAlert · .alert(_:isPresented:actions:message:) /

also called alert dialog, warning dialog, confirmation dialog, message box, system prompt

“The little warning window with the app icon and two buttons” is an alert — NSAlert. It shows your app icon (badged with a yellow caution triangle for warnings), a bold message line, smaller informative text, and buttons where the first added is the blue default. Run it app-modal with runModal(), or attach it to a single window with beginSheetModal(for:) — then it slides out of that window's title bar like a sheet. The “Don't ask me again” checkbox is its built-in suppression button.

Anatomy — every part, named

  1. 1
    Badged app iconNSAlert.icon

    “The yellow triangle over the app icon” is the alert icon — your app's icon, badged with the caution symbol when alertStyle is .warning or .critical.

  2. 2
    Message textNSAlert.messageText

    “The bold line” is messageText — the one-sentence summary, phrased as a question when the alert asks for a decision.

  3. 3
    Informative textNSAlert.informativeText

    “The smaller gray text under the bold line” is informativeText — the consequences, spelled out in a sentence.

  4. 4
    Suppression checkboxNSAlert.showsSuppressionButton

    “The don't ask me again checkbox” is the suppression button — enable it with showsSuppressionButton and read suppressionButton.state after the alert returns.

  5. 5
    Default buttonNSAlert.addButton(withTitle:)

    “The blue button” is the default button — the first button added to the alert; it gets the accent color and the Return key.

Prompt — paste into your agent

Show a native macOS alert with NSAlert (SwiftUI: .alert): messageText is the bold summary line, informativeText the smaller explanation. Add buttons with addButton(withTitle:) — the first one becomes the blue default button and answers the Return key; a button titled Cancel answers Escape. Set showsSuppressionButton = true for the “Don't ask me again” checkbox and read suppressionButton.state afterwards.

In code

The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).

AppKitNSAlert
SwiftUI.alert(_:isPresented:actions:message:)
AppKitNSAlert.messageText
AppKitNSAlert.informativeText
AppKitNSAlert.showsSuppressionButton
AppKitNSAlert.addButton(withTitle:)
AppKitNSAlert.alertStyle.warning / .informational / .critical
AppKitNSAlert.beginSheetModal(for:completionHandler:)attach to one window instead

See also

Search

Describe the UI element you're thinking of