Contents

encodeIfPresent(_:forKey:)

Encodes the given value for the given key if it is not 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.

Discussion