Getters and Setters Made Simple in Swift

Learn how and when to compute properties on demand

Artturi Jalli
Better Programming
Published in
3 min readApr 20, 2021

--

Code on a device
Photo by the author.

In Swift, the most common properties are stored properties and computed properties.

  • A stored property stores a value for later use (e.g. a variable that belongs to a class instance).
  • A computed property does not store a value. Instead, it computes it only when…

--

--