Type Method

unarchiveTopLevelObjectWithData(_:)

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

Declaration

@nonobjc class func unarchiveTopLevelObjectWithData(_ data: Data) throws -> Any?

Parameters

data

An object graph previously encoded by NSKeyedArchiver.

Return Value

The unarchived object, or nil if an error occurred.

Discussion

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

See Also

Unarchiving Data

static func unarchivedObject<DecodedObjectType>(ofClass: DecodedObjectType.Type, from: Data) -> DecodedObjectType?

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

static func unarchivedObject(ofClasses: [AnyClass], from: Data) -> Any?

Decodes a previously-archived object graph, returning the root object as one of the specified classes.

var requiresSecureCoding: Bool

Indicates whether the receiver requires all unarchived classes to conform to NSSecureCoding.

class func unarchiveObject(with: Data) -> Any?

Decodes and returns the object graph previously encoded by NSKeyedArchiver and stored in a given NSData object.

Deprecated
class func unarchiveObject(withFile: String) -> Any?

Decodes and returns the object graph previously encoded by NSKeyedArchiver written to the file at a given path.

Deprecated