<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/urlForImageResource(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(im)URLForImageResource:"
  },
  "title" : "urlForImageResource(_:)"
}
-->

# urlForImageResource(_:)

Returns the location of the specified image resource as an NSURL.

```
func urlForImageResource(_ name: NSImage.Name) -> URL?
```

## Parameters

`name`

The name of the image resource file. Including a filename extension is optional.

## Return Value

An `NSURL` for the resource file or `nil` if the file was not found.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)