Instance Method

decodeTopLevelObject(forKey:)

Decodes the previously-encoded object associated by a key.

Declaration

@nonobjc func decodeTopLevelObject(forKey key: String) throws -> Any?

Parameters

key

The key that identifies the object to decode.

Return Value

The decoded object, or nil if decoding fails.

See Also

Decoding Top-Level Objects

func decodeObject<DecodedObjectType>(of: DecodedObjectType.Type, forKey: String) -> DecodedObjectType?

Decode an object as an expected type, failing if the archived type doesn’t match.

func decodeObject(of: [AnyClass]?, forKey: String) -> Any?

Decode an object as one of several expected types, failing if the archived type doesn’t match any of the types.

func decodeTopLevelObject() -> Any?

Decodes a previously-encoded object.

func decodeTopLevelObject<DecodedObjectType>(of: DecodedObjectType.Type, forKey: String) -> DecodedObjectType?

Decode an object as one of several expected types, failing if the archived type does not match.

func decodeTopLevelObject(of: [AnyClass]?, forKey: String) -> Any?

Decode an object as one of several expected types, failing if the archived type does not match.