Contents

unarchivedObject(ofClass:from:)

Decodes a previously-archived object graph, and returns the root object as the specified type.

Declaration

@nonobjc static func unarchivedObject<DecodedObjectType>(ofClass cls: DecodedObjectType.Type, from data: Data) throws -> DecodedObjectType? where DecodedObjectType : NSObject, DecodedObjectType : NSCoding

Parameters

  • cls:

    The expected class of the root object.

  • data:

    An object graph previously encoded by Nskeyedarchiver.

Return Value

The decoded root of the object graph, or nil if an error occurred.

Discussion

This method produces an error if data does not contain valid keyed data.

See Also

Unarchiving Data