setTemporaryResourceValue(_:forKey:)
Sets a temporary resource value on the URL object.
Declaration
@preconcurrency mutating func setTemporaryResourceValue(_ value: any Sendable, forKey key: URLResourceKey)Discussion
Temporary resource values are for client use. Temporary resource values exist only in memory and are never written to the resource’s backing store. Once set, a temporary resource value can be copied from the URL object with func resourceValues(forKeys:). The values are stored in the loosely-typed allValues dictionary property.
To remove a temporary resource value from the URL object, use func removeCachedResourceValue(forKey:). Care should be taken to ensure the key that identifies a temporary resource value is unique and does not conflict with system defined keys (using reverse domain name notation in your temporary resource value keys is recommended). This method is currently applicable only to URLs for file system resources.