Daily iOS
CS fundamentals and algorithms

Hashable consistency

What problem does this type cause when you put it in a Set?

struct User: Hashable {
    let id: Int
    var name: String
    static func == (a: User, b: User) -> Bool { a.id == b.id }
    func hash(into h: inout Hasher) { h.combine(id); h.combine(name) }
}

Pick one

Submit