Continuing the discussion about variables in Swift, let us move on to properties, which are basically Swift constants or variables used in a class, structure, or enumeration. More specifically, they are stored values for a class, structure, or enumeration, that have getter and setter methods that can be modified. You can leave them alone, and they will do what they should (return the value or set a new one). The getters and setters can be overridden, like to override the setter to allow you to check if the input value is valid before storing it. Getters and setters are also called “accessors” and “mutators” respectively. Take your pick, but for me, I’m going to just call them getters and setters.
There are a few more aspects to properties, but today, we will be talking about a specific type of property. [Read more…]