October 2018
Beginner
750 pages
19h 11m
English
In the examples for references types, you saw the following snippet of code:
import UIKit let point = CGPoint(x: 10, y: 10) point.x = 10
At first sight, you might expect a value type to be a special kind of class because it looks like this snippet creates an instance of a class call CGPoint. You would be right in your observation, but your conclusion is wrong. CGPoint is not a class at all. Classes are inherently reference types, and they can't ever be something else. So what are value types, then?
There are two types of objects that are considered to be value types:
These two types are both very different, so let's make sure that you understand the basics of value types first, and then you'll learn what each of ...
Read now
Unlock full access