Contents

encode(_:forKey:)

Encodes an object and associates it with the string key.

Declaration

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

Discussion

Subclasses must override this method to identify multiple encodings of objv and encode a reference to objv instead. For example, NSKeyedArchiver detects duplicate objects and encodes a reference to the original object rather than encode the same object twice.

See Also

Related Documentation

Encoding General Data