---
title: icon
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsalert/icon
---

# icon

The custom icon displayed in the alert.

## Declaration

```swift
var icon: NSImage! { get set }
```

## Discussion

Discussion By default, the image used in an alert is the app icon. If you set this property’s value, your specified custom image is used in place of the app icon. If you’ve set a custom alert icon, you can clear it by setting this property’s value to nil, which restores use of the app icon for the alert. note: AppKit may omit the icon from the alert if it’s the app icon and the alert’s context is clear, such as being presented as a sheet on an app window.
