encode(_:)
Encodes an object.
Declaration
func encode(_ object: Any?)Discussion
NSCoder’s implementation simply invokes encodeValue(ofObjCType:at:) to encode object. Subclasses can override this method to encode a reference to object instead of object itself. For example, NSArchiver detects duplicate objects and encodes a reference to the original object rather than encode the same object twice.
This method must be matched by a subsequent decodeObject() message.
See Also
Encoding General Data
encodeArray(ofObjCType:count:at:)encode(_:forKey:)encodeBycopyObject(_:)encodeByrefObject(_:)encodeBytes(_:length:)encodeBytes(_:length:forKey:)encodeConditionalObject(_:)encodeConditionalObject(_:forKey:)encode(_:)encode(_:forKey:)encode(_:forKey:)encodeCInt(_:forKey:)encode(_:forKey:)encode(_:forKey:)encode(_:forKey:)