Initializer

init(wrappedValue:_:store:)

Creates a property that can read and write to a user default as data.

Declaration 宣言

init(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Data

Parameters パラメータ

wrappedValue

The default value if a data value is not specified for the given key.

key

The key to read and write the value to in the user defaults store. user defaults storeにおいてその値を読み出すそして書き出すためのキー。

store

The user defaults store to read and write to. A value of nil will use the user default store from the environment. それに読み出しおよび書き出しするuser defaults store。nilの値は、その環境からのuser default storeを使います。

Discussion 議論

Avoid storing large data blobs in user defaults, such as image data, as it can negatively affect performance of your app. On tvOS, a NSUserDefaultsSizeLimitExceededNotification notification is posted if the total user default size reaches 512kB.

See Also 参照

Storing a Value