Instance Method インスタンスメソッド

setTemporaryResourceValue(_:forKey:)

Sets a temporary resource value on the URL object. URLオブジェクト上の一時リソース値を設定します。

Declaration 宣言

mutating func setTemporaryResourceValue(_ value: Any, 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. 一時リソース値それらは、クライアントが使うためのものです。一時リソース値は、メモリの中にのみ存在します、そして決してリソースのもつバッキングストアに書き出されません。一旦設定されるならば、一時リソース値はURLオブジェクトからfunc resourceValues(forKeys:)でコピーされることができます。値は、遅延に型付けされるallValues辞書プロパティにおいて格納されます。

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. 一時リソース値をURLオブジェクトから取り除くには、func removeCachedResourceValue(forKey:)を使ってください。一時リソース値を識別するキーは特有でそしてシステム定義のキーと衝突しないことを確実にするよう注意を払われるべきです(逆ドメイン名表記をあなたの一時リソース値キーにおいて使うことは推奨されます)。このメソッドは、現在はファイルシステムリソースに対するURLにのみ適用可能です。

See Also 参照

Accessing Resource Values リソース値にアクセスする