Type Method

unarchivedObject(ofClasses:from:)

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

Declaration

@nonobjc static func unarchivedObject(ofClasses classes: [AnyClass], from data: Data) throws -> Any?

Parameters

classes

A set of classes, at least one of which the root object should conform to.

data

An object graph previously encoded by NSKeyedArchiver.

Return Value

The decoded root of the object graph, as an instance of one of the specified classes, or nil if an error occurred.

Discussion

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

See Also

Unarchiving Data

class func unarchiveTopLevelObjectWithData(Data) -> Any?

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

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.

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