-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning Swift
By :

All variables and constants in Swift are stored in the computer's memory. In fact, unless you explicitly write data to the filesystem, everything you create goes in the memory. In Swift, there are two different categories of types. These two categories are value types and reference types. The only way that they differ is in the way they behave when they are assigned to new variables, passed into methods, or captured in closures. Essentially, they only differ when you try to assign a new variable or constant to the value of an existing variable or constant.
A value type is always copied when it is assigned somewhere new, while a reference type is not. Before we look at exactly what this means in more detail, let's go over how we can determine whether a type is a value type or a reference type.
A value type is any type that is defined as either a structure or an enumeration, while all classes are reference types. It is easy...
Change the font size
Change margin width
Change background colour