<!--
{
  "availability" : [
    "SwiftPM: 5.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Resource/process(_:localization:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription8ResourceV7process_12localizationACSS_AC12LocalizationOSgtFZ"
  },
  "title" : "process(_:localization:)"
}
-->

# process(_:localization:)

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

```
static func process(_ path: String, localization: Resource.Localization? = nil) -> Resource
```

## Parameters

`path`

The path for a resource.

`localization`

The explicit localization type for the resource.

## Return Value

A `Resource` instance.

## Discussion

Use the `process` rule to process resources at the given path according
to the platform Swift Package Manager builds the target for. For example, Swift Package Manager may
optimize image files for platforms that support such optimizations. If
no optimization is available for a file type, Swift Package Manager copies the file.

If the given path represents a directory, Swift Package Manager applies the process rule
recursively to each file in the directory.

If possible, use this rule instead of [`copy(_:)`](/documentation/PackageDescription/Resource/copy(_:)).

---

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)