---
title: "icon(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextension/action/icon(for:)"
---

# icon(for:)

Returns the action icon for the specified size.

## Declaration

```swift
func icon(for size: CGSize) -> UIImage?
```

```swift
func icon(for size: CGSize) -> NSImage?
```

## Parameters

- `size`: The size to use when looking up the action icon.

## Return Value

Return Value The action icon, or nil if the icon was unable to be loaded.

## Discussion

Discussion This icon should represent the extension in action sheets or toolbars. The returned image will be the best match for the specified size that is available in the extension’s action icon set. If no matching icon is available, the method will fall back to the extension’s icon.
