April 2017
Intermediate to advanced
316 pages
9h 33m
English
The Swift Programming Language by Apple Inc. has a section on comparing structs (value type) and classes (reference type) and how to prefer one over the other. It is highly recommended to read that section to understand why we prefer one over the other. Although we touched on the topic briefly in Chapter 1, Getting Started With Functional Programming in Swift, we will explore this topic further as the distinction between reference and value types is very important in FP.
In OOP, we model real-world objects as classes and interfaces. For instance, to model an Italian restaurant with different types of pizzas, we may have a Pizzaclass and subclasses of it such as Margherita, Napoletana, or Romana. Each of these ...
Read now
Unlock full access