<!--
{
  "availability" : [
    "iOS: 9.0.0 - 27.0.0",
    "iPadOS: 9.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 2.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Bundle/setPreservationPriority(_:forTags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(im)setPreservationPriority:forTags:"
  },
  "title" : "setPreservationPriority(_:forTags:)"
}
-->

# setPreservationPriority(_:forTags:)

A hint to the system of the relative order for purging tagged sets of resources in the bundle.

```
func setPreservationPriority(_ priority: Double, forTags tags: Set<String>)
```

## Parameters

`priority`

A number specifying the relative priority of preserving the resources in the group specified by `tag`.

    Possible values are between     `0.0`     and     `1.0`    . The default is     `0.0`    . The system will attempt to purge resources with lower priorities first.

`tags`

A set of tag names specifying resources stored in the bundle. Must not be `nil`. An exception is thrown if any of the tags in the set do not exist in your app.

---

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)