Member-only story

Understanding Stored and Computed Properties in Swift

Everything you need to know about stored and computed properties

Gabriel Theodoropoulos
Better Programming
8 min readAug 13, 2021

--

Photo by Christopher Gower on Unsplash

A concept that all developers meet early when start programming in Swift is about properties. This term is one of the most common ones that somebody reads, writes, or talks about in programming articles, books, courses, or discussions.

Putting it in plain words, properties are variables and constants that store values, and that we declare in Swift classes, structures, and enumerations. But properties are not unique to Swift. We meet them in every Object-Oriented Programming (OOP) language.

Regardless, two new terms are getting into the play-around properties soon enough — stored and computed. Even though both explain their meaning somehow, one realizes what they actually are only after exploring them.

It’s often the case where programmers are writing code without even having heard about the existence of these concepts. It’s a fact that we can write entire apps without knowing the slightest detail about those. So, why is it necessary to learn about them?

Well, first of all, since stored and computed properties exist as concepts in the Swift language, they become a must-have knowledge that everybody should be understanding and possess.

--

--

Gabriel Theodoropoulos
Gabriel Theodoropoulos

Written by Gabriel Theodoropoulos

An iOS & macOS app maker writing code in Swift. Author of countless programming tutorials. Content creator. https://serialcoder.dev

Responses (1)

Write a response