Skip to content

Instantly share code, notes, and snippets.

View vitu86's full-sized avatar

Vitor Costa vitu86

View GitHub Profile
@vitu86
vitu86 / ClassVsStruct.md
Last active February 17, 2025 14:57
Differences and similarities between Class and Struct in Swift

Based on SwiftDocs

Let's do this in a practical way...

1. Properties:

Classes and Structures both can store properties:

Properties

As you can see in the image, there's one first difference: a class need an explicit init method. So, we have to do this: