Instance Method


Informs the delegate that the class with a given name is not available during decoding.


optional func unarchiver(_ unarchiver: NSKeyedUnarchiver, cannotDecodeObjectOfClassName name: String, originalClasses classNames: [String]) -> AnyClass?



An unarchiver for which the receiver is the delegate.


The name of the class of an object unarchiver is trying to decode.


An array describing the class hierarchy of the encoded object, where the first element is the class name string of the encoded object, the second element is the class name of its immediate superclass, and so on.

Return Value

The class unarchiver should use in place of the class named name.


The delegate may, for example, load some code to introduce the class to the runtime and return the class, or substitute a different class object. If the delegate returns nil, unarchiving aborts and the method raises an NSInvalidUnarchiveOperationException.

See Also

Decoding Objects

func unarchiver(NSKeyedUnarchiver, didDecode: Any?) -> Any?

Informs the delegate that a given object has been decoded.

func unarchiver(NSKeyedUnarchiver, willReplace: Any, with: Any)

Informs the delegate that one object is being substituted for another.