I've two structs, a User and Chat
struct User {
let appId: String
}
struct Chat {
var users: [User]
}
So if you can see a chat can have multiple users.
let u1 = User(appId: "12345")
let u2 = User(appId: "6789")
let chat = Chat(users: [u1, u2])
Now I'd like to detect if these two users are inside the chat, maybe by the appId
I tried
let contains = chat.users.contains { inUser -> Bool in
return inUser.appId == "12345" && inUser.appId == "6789"
}
But for sure that will not work.
Someone can help me? Thanks!