Apple's Swift 4 recently introduced some amazing new features to support archiving/unarchiving as part of Foundation. This post explores some techniques for unarchiving/decoding while ensuring that instances of reference types can be shared within the object graph based on an arbitrary identifier.
Stepping back a little, imagine you had a simple construct representing a Car and its owner/driver. Using value types, this might look like:
struct Person : Codable {
let identifier: Int
}