Contents

encodeConditionalObject(_:forKey:)

Encodes a reference to a given object and associates it with a key only if it has been unconditionally encoded elsewhere in the archive.

Declaration

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

Parameters

  • object:

    The object to encode.

  • key:

    The key with which to associate the encoded value. This value must not be nil.

Discussion

This method is effective only if you’ve previously archived this object with this key by calling encodeInt:forKey:.

See Also

Encoding Data and Objects