<!--
{
  "availability" : [
    "SwiftPM: 5.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Resource",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription8ResourceV"
  },
  "title" : "Resource"
}
-->

# Resource

A resource to bundle with the Swift package.

```
struct Resource
```

## Overview

If a Swift package declares a Swift tools version of 5.3 or later, it can
include resource files. Similar to source code, Swift Package Manager scopes resources to a
target, so you must put them into the folder that corresponds to the target
they belong to. For example, any resources for the `MyLibrary` target must
reside in `Sources/MyLibrary`. Use subdirectories to organize your resource
files in a way that simplifies file identification and management. For
example, put all resource files into a directory named `Resources`, so they
reside at `Sources/MyLibrary/Resources`.

By default, Swift Package Manager handles common resources types for Apple platforms
automatically. For example, you don’t need to declare XIB files,
storyboards, Core Data file types, and asset catalogs as resources in your
package manifest. However, you must explicitly declare other file types — for
example, image files — as resources using the
[`process(_:localization:)`](/documentation/PackageDescription/Resource/process(_:localization:)) or [`copy(_:)`](/documentation/PackageDescription/Resource/copy(_:)) rules.
Alternatively, exclude resource files from a target by passing them to the
target initializer’s [`exclude`](/documentation/PackageDescription/Target/exclude) parameter.

To learn more about package resources, see [Bundling resources as a Swift Package](https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package).

## Topics

### Applying Rules

[`process(_:localization:)`](/documentation/PackageDescription/Resource/process(_:localization:))

Applies a platform-specific rules to the resource at the given path.

[`Localization`](/documentation/PackageDescription/Resource/Localization)

Defines the explicit type of localization for resources.

[`copy(_:)`](/documentation/PackageDescription/Resource/copy(_:))

Applies the copy rule to a resource at the given path.

[`embedInCode(_:)`](/documentation/PackageDescription/Resource/embedInCode(_:))

Applies the embed rule to a resource at the given path.

## Relationships

### Conforms To

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

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

---

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)