Contents

NSSecureUnarchiveFromDataTransformer

A value transformer that converts data to and from classes that support secure coding.

Declaration

class NSSecureUnarchiveFromDataTransformer

Overview

This class provides a default ValueTransformer implementation for secure decoding. This class attempts to decode data into the classes listed within allowedTopLevelClasses, which includes NSArray, NSDictionary, NSSet, NSString, NSNumber, NSDate, NSData, NSURL, NSUUID, and NSNull.

To archive or unarchive other classes that support NSSecureCoding, create a subclass and override allowedTopLevelClasses to list the classes to transform.

To use NSSecureUnarchiveFromDataTransformer with Core Data, use the name of this class, or the name of a subclass you implement, as the name of the transformer for an entity’s attribute within a Core Data Model. If you use your own transformer subclass, register it with your app before intializing your persistent container with Core Data.

For an example of subclassing NSSecureUnarchiveFromDataTransformer, see Handling Different Data Types in Core Data, which has a ColorToDataTransformer class that transforms UIColor to NSData and the reverse, to support archiving instances of UIColor.

Topics

Getting Information About a Transformer

See Also

Keyed Archivers