Check if an array contains elements of another array in swift
问题 I need to check if an array contains at least one or more elements of another array and print them out in swift. This is my situation: var array1 = ["user1", "user2", "user3", "user4"] var array2 = ["user3, "user5", "user7", "user9, "user4"] //I need to get back an array that says that both the arrays contains ex. "user3" and "user4" I searched the web but i only found the opposite answer that helps t check if there is a difference between 2 arrays using array.symmetricDifference() Any helps?