---
title: "urlForImageResource(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/bundle/urlforimageresource(_:)"
---

# urlForImageResource(_:)

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

## Declaration

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

## Parameters

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

## Return Value

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

## See Also

### Finding image resources

- [pathForImageResource(_:)](foundation/bundle/pathforimageresource(_:).md)
- [image(forResource:)](foundation/bundle/image(forresource:).md)
