<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLResource",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11URLResourceV"
  },
  "title" : "URLResource"
}
-->

# URLResource

A resource located at a particular file URL within a bundle.

```
struct URLResource
```

## Overview

This type is similar to [`LocalizedStringResource`](/documentation/Foundation/LocalizedStringResource) in its ability to provide access to a resource in a bundle, possibly from another process. Use the [`URL`](/documentation/Foundation/URL) initializer [`init(resource:)`](/documentation/Foundation/URL/init(resource:)) to resolve the resource.

## Topics

### Creating a URL resource

[`init(name: String, subdirectory: String?, locale: Locale, bundle: Bundle)`](/documentation/Foundation/URLResource/init(name:subdirectory:locale:bundle:))

Creates a URL resource from the given bundle, name, and subdirectory, optionally specifying a locale.

### Accessing resource properties

[`let bundle: Bundle`](/documentation/Foundation/URLResource/bundle)

The bundle containing the resource.

[`let name: String`](/documentation/Foundation/URLResource/name)

The name of the resource in the bundle.

[`let subdirectory: String?`](/documentation/Foundation/URLResource/subdirectory)

The subdirectory, if any, of the resource.

[`var locale: Locale`](/documentation/Foundation/URLResource/locale)

The bundle containing the resource.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`Hashable`](/documentation/Swift/Hashable)

[`Decodable`](/documentation/Swift/Decodable)

---

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)