---
title: "imageDidNotDraw(_:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsimagedelegate/imagedidnotdraw(_:in:)"
---

# imageDidNotDraw(_:in:)

Tells the delegate that the image object is unable, for whatever reason, to lock focus on its image or draw in the specified rectangle.

## Declaration

```swift
nonisolated optional func imageDidNotDraw(_ sender: NSImage, in rect: NSRect) -> NSImage?
```

## Parameters

- `sender`: The NSImage object that encountered the problem.
- `rect`: The rectangle that the image object was attempting to draw.

## Return Value

Return Value An NSImage to draw in place of the one in sender, or nil if the delegate wants to draw the image itself.

## Discussion

Discussion The delegate can do one of the following: Return another NSImage object to draw in the sender’s place. Draw the image itself and return nil. Simply return nil to indicate that sender should give up on the attempt at drawing the image.

## See Also

### Related Documentation

- [NSImage](appkit/nsimage.md)
