concept struct in category swift

This is an excerpt from Manning's book Swift in Depth.
Swift can’t stop you from writing bugs or poor code, but it does help reduce program errors at compile time using various techniques, including, but not limited to, static typing and strong support for algebraic data types (enums, structs, and tuples). Swift also prevents null errors thanks to optionals.
Getting compiler benefits with enums is a significant benefit. But if you catch yourself pattern matching often on a single case, a struct might be a better approach.
On the other end of the spectrum are product types. A product type multiplies the possible values it contains. As an example, if you were to store two Booleans inside a struct, the total number of variations is the product (multiplication) of these two enums.
Next, you’re going to represent the status of a payment. A struct is a suitable candidate to store some auxiliary properties besides the PaymentType enum, such as when a payment is completed and whether or not it concerns a recurring payment.
Listing 2.30. A PaymentStatus struct
struct PaymentStatus { let paymentDate: Date? let isRecurring: Bool let paymentType: PaymentType }The product of all the variations would be all possible dates times 2 (Boolean) times 3 (enum with three cases). You’d have a high number of variations because the struct can store many date variations.
Like cream cheese on a bagel, you’re smearing the properties of the struct out over the cases of the enum by following the rules of algebraic data types (see figure 2.5).
You end up with an enum taking the same name as the struct. Each case represents the original enum’s cases with the struct’s properties inside.
Let’s create a data model to represent messages. Your first idea might be to use a struct to model your Message. You’ll start by doing that and showcase the problems that come with it. Then you’ll solve these problems by using an enum.