Contents

encodeConditionalObject(_:forKey:)

An encoding method for subclasses to override to conditionally encode an object, preserving common references to it, only if it has been unconditionally encoded.

Declaration

func encodeConditionalObject(_ object: Any?, forKey key: String)

Discussion

Subclasses must override this method if they support keyed coding.

The encoded object is decoded with the decodeObject(forKey:) method. If objv was never encoded unconditionally, decodeObject(forKey:) returns nil in place of objv.

See Also

Encoding General Data