---
title: "canInit(with:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsimage/caninit(with:)"
---

# canInit(with:)

Tests whether the image can create an instance of itself using pasteboard data.

## Declaration

```swift
class func canInit(with pasteboard: NSPasteboard) -> Bool
```

## Parameters

- `pasteboard`: The pasteboard containing the image data.

## Return Value

Return Value true if the receiver knows how to handle the data on the pasteboard; otherwise, false.

## Discussion

Discussion This method uses the NSImageRep class method imageUnfilteredPasteboardTypes() to find a class that can handle the data in the specified pasteboard. If you create your own NSImageRep subclasses, override the imageUnfilteredPasteboardTypes() method to notify NSImage of the pasteboard types your class supports.

## See Also

### Related Documentation

- [imagePasteboardTypes()](appkit/nsimage/imagepasteboardtypes().md)

### Determining Supported Types of Images

- [imageTypes](appkit/nsimage/imagetypes.md)
- [imageUnfilteredTypes](appkit/nsimage/imageunfilteredtypes.md)
