Structs

Bye bye classes!! Hello Structs

SwiftUI is based solely on structs over classes.

Classes are reference types, while structs are value types

Classes – Reference types

When we pass an object that is based on a class to a function or another instance, we are
actually working and modifying the original instance because the object we passed is just a
reference.

Struct – Value types

Whenever we pass a struct to a function, we work with a copy of that struct, not the original one.

The result of the code will be Avi, and then John. However, if we declare A as a class, the
results would be John and John because it’s a reference to the original variable

From LinkedIn