---
title: "process(_:localization:)"
framework: swift-package-manager
role: symbol
role_heading: Type Method
path: "swift-package-manager/documentation/packagedescription/resource/process(_:localization:)"
---

# process(_:localization:)

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

## Declaration

```swift
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

Return Value A Resource instance.

## Discussion

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(_:).

## See Also

### Applying Rules

- [Resource.Localization](swift-package-manager/documentation/packagedescription/resource/localization.md)
- [copy(_:)](swift-package-manager/documentation/packagedescription/resource/copy(_:).md)
- [embedInCode(_:)](swift-package-manager/documentation/packagedescription/resource/embedincode(_:).md)
