One more thing about properties is that you can also define them on the type itself (a class, struct, enum). Useful when you want to define properties which are the same to all instances of that type.
The benefit of type properties:
You have access to them without needing to create a new object of that specific type.
These type properties area available to any instance of that particular type
Type properties can be both computed or stored properties (var or let). However, in a class, a type property which you want to be overridden in subclass, can only be a computed property. You will get this error if you try otherwise: error: class stored properties not supported in classes; did you mean ‘static’?
Due to the lack of initialization in a type property, you need to provide default values, but you have access to it without initializing the type.
In terms of keywords to use, there is a small but relevant difference between value types (struct and enums) and reference types (classes).
Struct / Enum:
Type properties in structs and enum begin with the keyword struct
Type properties in classes, due the their reference type, will use the keyword static if the type property is not meant to be overridden by a subclass, and the keyword class if it does (in that situation, in the subclass you also must use the keyword override to signal to the compiler that the subclass is implementing it’s own type property)
Also, if you want to use the keyword class so that the property can be changed in the subclass, it seems that you can’t use it on a stored property.
One other important difference is that a static property in class cannot be overridden by a subclass, but it is available for use by the subclass via dot syntax (you access a type property by using the type name followed by a dot (.) and the name of the type property).
You can see this with OctagonSide2 which has access to the static property sides from its superclass