Изменения в новых версиях / Swift 4.1

// *** before: ***
// an array was Equatable only through built-in overloads, so an array of
// arrays or an optional array had to be compared by hand
let a = [[12], [3]]
let b = [[12], [3]]
print(a.count == b.count && !zip(a, b).contains { $0 != $1 })

// *** in version 4.1: ***
print(a == b)                 // Array is Equatable when its Element is

let maybe: [Int]? = [12]
print(maybe == [12])        // and Optional too

// our own types get the same rule
struct Box<T> {
    let value: T
}

extension Box: Equatable where T: Equatable { }
extension BoxCodable where TCodable { }

print(Box(value: 1) == Box(value: 1))
let data = try JSONEncoder().encode(Box(value: 1))