---
title: "setResourceValues(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/url/setresourcevalues(_:)"
---

# setResourceValues(_:)

Sets the resource value identified by a given resource key.

## Declaration

```swift
mutating func setResourceValues(_ values: URLResourceValues) throws
```

## Mentioned in

Using the file system effectively

## Discussion

Discussion This method writes the new resource values out to the backing store. Attempts to set a read-only resource property or to set a resource property not supported by the resource are ignored and are not considered errors. This method is currently applicable only to URLs for file system resources. URLResourceValues keeps track of which of its properties have been set. Those values are the ones used by this function to determine which properties to write.

## See Also

### Accessing resource values

- [resourceValues(forKeys:)](foundation/url/resourcevalues(forkeys:).md)
- [removeCachedResourceValue(forKey:)](foundation/url/removecachedresourcevalue(forkey:).md)
- [removeAllCachedResourceValues()](foundation/url/removeallcachedresourcevalues().md)
- [setTemporaryResourceValue(_:forKey:)](foundation/url/settemporaryresourcevalue(_:forkey:).md)
- [URLResourceKey](foundation/urlresourcekey.md)
- [URLResourceValues](foundation/urlresourcevalues.md)
