Swiftui Check If Two Array Contains Same Element

[Solved] Swiftui Check If Two Array Contains Same Element | Vb - Code Explorer | yomemimo.com
Question : swiftui check if two arrays contain same element

Answered by : tony-sacco

let array1 = [2, 3, 4, 5]
let array2 = [20, 15, 2, 7]
if array1.contains(where: array2.contains) { print("Array 1 and array 2 share at least one common element")
} else { print("Array 1 doesn't contains any elements from array 2")
}

Source : https://stackoverflow.com/questions/37299385/swift-determine-if-array1-contains-at-least-one-object-from-array2 | Last Update : Mon, 05 Dec 22

Answers related to swiftui check if two array contains same element

Code Explorer Popular Question For Vb