I have two struct and two arrays corresponding to it and I am trying to compare the two array values and print it in one filtered array i did try and use filter but its giving m
Swift standard library has an Equatable protocol that we can adopt by adding the static == operator function to our type in an extension. You should create only one structure like below
struct Employee {
let id: String
let name: String
var lastName: String
}
extension Employee: Equatable {
static func == (lhs: Employee, rhs: Employee) -> Bool {
return lhs.name == rhs.name &&
lhs.id == rhs.id &&
lhs.lastName == rhs.lastName
}
}