Initializes and returns an image object using the specified URL.
- macOS 10.2+
The URL identifying the image.
This method initializes the image object lazily. It does not attempt to retrieve the data from the specified URL or create any image representations from that data until an app attempts to draw the image or request information about it.
url parameter should include a file extension that identifies the type of the image data. The mechanism that actually creates the image representation looks for an
NSImage subclass that handles that data type from among those registered with
Because this method doesn’t actually create image representations for the image data, your app should do error checking before attempting to use the image; one way to do so is by accessing the
valid property to check whether the image can be drawn.
This method invokes
set with an argument of
YES, thus enabling it to hold onto its URL. When archiving an image created with this method, only the image's URL is written to the archive.