Contents

replacementObject(for:)

Overridden by subclasses to substitute another object for itself during encoding.

Declaration

func replacementObject(for coder: NSCoder) -> Any?

Parameters

  • coder:

    The coder encoding the receiver.

Return Value

The object encode instead of the receiver (if different).

Discussion

An object might encode itself into an archive, but encode a proxy for itself if it’s being encoded for distribution. This method is invoked by NSCoder. NSObject’s implementation returns self.

See Also

Archiving