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

set(_:forKey:)

Sets the value of the specified default key. 指定されたdefaultキーの値を設定します。

Declaration 宣言

func set(_ value: Any?, 
  forKey defaultName: String)

Parameters パラメータ

value

The object to store in the defaults database. defaultsデータベースに格納するオブジェクト。

defaultName

The key with which to associate the value. それと値を結びつけることになるキー。

Discussion 議論

The value parameter can be only property list objects: NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. For NSArray and NSDictionary objects, their contents must be property list objects. For more information, see What is a Property List? in Property List Programming Guide. valueパラメータは、プロパティリストオブジェクトのみであることができます:NSDataNSStringNSNumberNSDateNSArray、またはNSDictionaryNSArrayNSDictionaryオブジェクトに対して、それらの内容はプロパティリストオブジェクトでなければなりません。さらなる情報として、What is a Property List?Property List Programming Guideにおいて見てください。

Setting a default has no effect on the value returned by the object(forKey:) method if the same key exists in a domain that precedes the application domain in the search list. あるdefaultを設定することは、object(forKey:)メソッドによって返される値に影響を及ぼしません、もし検索リストにおいてアプリケーションドメインより前にあるドメインに同じキーが存在するならば。

See Also 参照

Setting Default Values defaultの値を設定する

Related Documentation 関連文書