October 2017
Intermediate to advanced
210 pages
5h 32m
English
In this section, we will show how we can conform to the Equatable protocol using extensions. When a type conforms to the Equatable protocol, we can use the equal-to (==) operator to compare for equality and the not-equal-to (!=) operator to compare for inequality.
Let's start off by creating the type that we will compare. We will name this type Place:
struct Place {
let id: String
let latitude: Double
let longitude: Double
}
In the Place type, we have three properties that represent the ID of the place and the latitude and longitude ...
Read now
Unlock full access