AliasDereferencingStrategy
public protocol AliasDereferencingStrategy : AnyObject
A class-bound protocol which implements a strategy for dereferencing aliases (or dealiasing) values during
YAML document decoding. YAML documents which do not contain anchors will not benefit from the use of
an AliasDereferencingStrategy in any way. The main use-case for dereferencing aliases in a YML document
is when decoding into class types. If the yaml document is large and contains many references
(perhaps it is a representation of a dense graph) then, decoding into structs will require the of large amounts
of system memory to represent highly redundant (duplicated) data structures.
However, if the same document is decoded into class types and the decoding uses
an AliasDereferencingStrategy
such as BasicAliasDereferencingStrategy
then the emitted value will have its
class references coalesced. No duplicate objects will be initialized (unless identical objects have multiple
distinct anchors in the YAML document). In some scenarios this may significantly reduce the memory footprint of
the decoded type.
-
The stored exestential type of all AliasDereferencingStrategys
Declaration
Swift
typealias Value = (any Decodable)
-
get and set cached references, keyed bo an Anchor