Instance Property

requiresSecureCoding

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

Declaration

var requiresSecureCoding: Bool { get set }

Parameters

flag

true if the receiver requires NSSecureCoding; false if not.

Discussion

If you set the receiver to require secure coding, it will throw an exception if you attempt to unarchive a class which does not conform to NSSecureCoding.

The secure coding requirement for NSKeyedUnarchiver is designed to be set once at the top level and remain on. Once enabled, attempting to call setRequiresSecureCoding: with a value of false will throw an exception. This is to prevent classes from selectively turning secure coding off.

Note that the getter is on the superclass, NSCoder. See NSCoder for more information about secure coding.

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.

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

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

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software