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
- 1Badged app icon
NSAlert.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.
- 2Message text
NSAlert.messageText“The bold line” is messageText — the one-sentence summary, phrased as a question when the alert asks for a decision.
- 3Informative text
NSAlert.informativeText“The smaller gray text under the bold line” is informativeText — the consequences, spelled out in a sentence.
- 4Suppression checkbox
NSAlert.showsSuppressionButton“The don't ask me again checkbox” is the suppression button — enable it with showsSuppressionButton and read suppressionButton.state after the alert returns.
- 5Default button
NSAlert.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).
| AppKit | NSAlert | |
| SwiftUI | .alert(_:isPresented:actions:message:) | |
| AppKit | NSAlert.messageText | |
| AppKit | NSAlert.informativeText | |
| AppKit | NSAlert.showsSuppressionButton | |
| AppKit | NSAlert.addButton(withTitle:) | |
| AppKit | NSAlert.alertStyle | .warning / .informational / .critical |
| AppKit | NSAlert.beginSheetModal(for:completionHandler:) | attach to one window instead |