Type-safe identifiers in Swift
In most code bases, we need a way to uniquely identify certain values and objects. This week, let’s take a look at how we can create type-safe identifiers that enable us to write more robust model handling code.
Articles, podcasts and news about Swift development, by John Sundell.
In most code bases, we need a way to uniquely identify certain values and objects. This week, let’s take a look at how we can create type-safe identifiers that enable us to write more robust model handling code.
We often encounter situations in which we need to find a way to store objects based on some concept of identity. Whether it's in a cache, storing representations of objects on disk, or simply using a dictionary - we often need to find ways to uniquely identify the objects that we deal with. Let's take a look at a few such ways.