A struct is similar to a C++ Struct. You are essentially just creating your own data type
This is what it would look like to declare a struct
To instantiate a struct variable it would look like this
You can access the properties of a struct using Dot Notation
For structs constructors are implicitly created so you do not need to declare one although you can. For this structs are preferable over classes in Swift.
This is how you would create a custom constructor for your struct
A constructor will have the keyword “init” which would be the only keyword for this special “function”
Structs also have Computed Properties
So far all the structs above have been immutable
How would a mutable struct look like?
You need to use the mutating keyword before the func keyword. This tells the swift compiler that this function is going to be changing the values in the struct. While this can be done this is bad practice and shouldn’t really be done in a struct.
Swift structs do not have SubClassing