Classes vs. Structs in Swift — Basics and Memory Management

Value types vs. reference types, stack vs. heap allocation, and more

Neel Bakshi
Better Programming
Published in
7 min readMar 25, 2021

--

Photo by Fotis Fotopoulos on Unsplash.

I’ve been asked this question many times during interviews: “What is a class and what is a struct? Mention a few differences and when you would use them.”

--

--

Guy who handles everything mobile @headout among other things! Ex @practo