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

# canInit(with:)

Returns a Boolean value that indicates whether the image representation can initialize itself from the specified data.

## Declaration

```swift
class func canInit(with data: Data) -> Bool
```

## Parameters

- `data`: 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 should be overridden by subclasses. Note that this method does not need to do a comprehensive check of the image data; it should return false only if it knows it cannot initialize itself from the data.

## See Also

### Determining Types for Images

- [canInit(with:)](appkit/nsimagerep/caninit(with:)-56pum.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)
