SwiftIOSProgrammingTechnologyMobile The story of one mother & two sons: value type vs reference type in Swift
Boudhayan Biswas
6 min readMay 21, 2019
--
Swift is a mother🤰and it has two sons 👬-
Value Type 🚴🏻♀️
Reference Type 🚴♂️
But what are their characteristics?🤼♂️
Do they behave the same or opposite to each other? 🧘♂️
Swift is a multi-paradigm programming language developed by Apple for iOS, macOS, watchOS, tvOS, Linux, and z/OS.💪
Just like other object-oriented programming languages, Swift has classes as building blocks which can define methods, properties, initializers, and can conform to protocols, support inheritance & polymorphism.👍
But, wait wait wait…🖐🖐🖐
Swift has structs also and it can define methods, properties, initializers and can conform to protocols with only one exception of inheritance.😳
What? Now I am confused!!! 🤔🤔🤔
Now let’s spice up your confusion: structs are not only the value types in Swift. Tuples and enums are also value types.…