I'm learning swift and read a topic about operator overloading in extensions, which likes:
extension StreetAddress: Equatable {
static func == (lhs: StreetAddress, rhs: StreetAddress) -> Bool {
return
lhs.number == rhs.number &&
lhs.street == rhs.street &&
lhs.unit == rhs.unit
}
}
But how i can know i need to adopt the Equatable?
I tried to remove that protocol and the function works the same. No warnings or errors be reported. Why?