canInit(with:)
Returns a Boolean value that indicates whether the receiver can initialize itself from the data on the specified pasteboard.
Declaration
class func canInit(with pasteboard: NSPasteboard) -> BoolParameters
- pasteboard:
The pasteboard containing the image data.
Return Value
true if the receiver understands the format of the specified data and can use it to initialize itself; otherwise, false.
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.