Required Instance Methodswift 6.0.3Swift

encodeIfPresent(_:forKey:)

Encodes the given value for the given key if it is not nil.

iOS
18.0+
macOS
15.0+
tvOS
18.0+
visionOS
2.0+
watchOS
11.0+
mutating func encodeIfPresent(_ value: UInt128?, forKey key: Self.Key) throws

Parameters

value

The value to encode.

key

The key to associate the value with.

Throws

EncodingError.invalidValue if the given value is invalid in the current context for this format.