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

# canInit(with:)

Returns a Boolean value that indicates whether the receiver can initialize itself from the data on the specified pasteboard.

## 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 understands the format of the specified data and can use it to initialize itself; otherwise, false.

## Discussion

Discussion This method invokes the imageUnfilteredPasteboardTypes() class method and checks the list of types returned by that method against the data types in pasteboard. If it finds a match, it returns true. When creating a subclass of NSImageRep that accepts image data from a non-default pasteboard type, override the imageUnfilteredPasteboardTypes() method to assure this method returns the correct response.

## See Also

### Determining Types for Images

- [canInit(with:)](appkit/nsimagerep/caninit(with:)-6zv56.md)
- [imageTypes](appkit/nsimagerep/imagetypes.md)
- [imageUnfilteredTypes](appkit/nsimagerep/imageunfilteredtypes.md)
- [imageFileTypes()](appkit/nsimagerep/imagefiletypes().md)
- [imagePasteboardTypes()](appkit/nsimagerep/imagepasteboardtypes().md)
- [imageUnfilteredFileTypes()](appkit/nsimagerep/imageunfilteredfiletypes().md)
- [imageUnfilteredPasteboardTypes()](appkit/nsimagerep/imageunfilteredpasteboardtypes().md)
