Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Structs are Value-Types. Perfect for “Models” and “Views” in SwiftUI; on the other hand, classes are Reference-Types, which you need for your “View Models”. This is an example I could show using the popular MVVM design pattern. I don’t think there is any major difference in readability for the two. To sum up, use whatever you need in your situation but if you are not sure, then use Struct.
12th Jun 2021, 1:35 PM
Pawel Zabinski
Pawel Zabinski - avatar