Generic Instance Method 総称体インスタンスメソッド

encodeIfPresent(_:forKey:)

Encodes the given value for the given key if it is not nil. 与えられたキーに対して与えられた値をエンコードします、それがnilでないならば。

Declaration 宣言

mutating func encodeIfPresent<T>(_ value: T?, forKey key: Self.Key) throws where T : Encodable

Parameters パラメータ

value

The value to encode. エンコードする値。

key

The key to associate the value with. 値と関連付けられるキー。