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

decodeIfPresent(_:)

Decodes a value of the given type, if present. 与えられた型の値をデコードします、もし存在するならば。

Declaration 宣言

mutating func decodeIfPresent(_ type: UInt16.Type) throws -> UInt16?

Parameters パラメータ

type

The type of value to decode. この型の値にデコードする。

Return Value 戻り値

A decoded value of the requested type, or nil if the value is a null value, or if there are no more elements to decode. 要求された型にデコード済みの値、またはnil、もしその値がnull値ならば、またはもしデコードする要素がそれ以上ないならば。

Discussion 解説

This method returns nil if the container has no elements left to decode, or if the value is null. The difference between these states can be distinguished by checking isAtEnd. このメソッドはnilを返します、もしコンテナがデコードするのに残る要素を持たないならば、またはもし値がnullならば。これらの状態の間の差は、isAtEnd.