---
title: "imageReps(with:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsimagerep/imagereps(with:)"
---

# imageReps(with:)

Creates and returns an array of image representation objects initialized using the contents of the pasteboard.

## Declaration

```swift
class func imageReps(with pasteboard: NSPasteboard) -> [NSImageRep]?
```

## Parameters

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

## Return Value

Return Value An array of image representation objects. The array contains one object for each image in the specified pasteboard.

## Discussion

Discussion If sent to the NSImageRep class object, this method returns an array of objects (all newly-allocated instances of a subclass of NSImageRep) that have been initialized with the data in the specified pasteboard. If sent to a subclass of NSImageRep that recognizes the pasteboard data, it returns an array of objects (all instances of that subclass) initialized with the pasteboard data. This method returns nil in any of the following cases: The message is sent to the NSImageRep class object and there are no subclasses in the NSImageRep class registry that handle the pasteboard data. The message is sent to a subclass of NSImageRep and that subclass cannot handle the pasteboard data. The NSImageRep subclass is unable to initialize itself with the contents the pasteboard. The NSImageRep subclass is initialized by creating an NSData object based on the data in pasteboard and passing it to the imageRepsWithData: method.

## See Also

### Related Documentation

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

### Creating Representations of Images

- [imageReps(withContentsOfFile:)](appkit/nsimagerep/imagereps(withcontentsoffile:).md)
- [imageReps(withContentsOf:)](appkit/nsimagerep/imagereps(withcontentsof:).md)
- [init(contentsOfFile:)](appkit/nsimagerep/init(contentsoffile:).md)
- [init(pasteboard:)](appkit/nsimagerep/init(pasteboard:).md)
- [init(contentsOf:)](appkit/nsimagerep/init(contentsof:).md)
- [init()](appkit/nsimagerep/init().md)
- [init(coder:)](appkit/nsimagerep/init(coder:).md)
