I have 2 arrays:
var list:Array = [1,2,3,4,5]
var findList:Array = [1,3,5]
I want to determine if list A
In Swift 3 or Swift 4 you can write this:
extension Array where Element: Equatable {
func contains(array: [Element]) -> Bool {
for item in array {
if !self.contains(item) { return false }
}
return true
}
}
You can see the contains method here
This is just a simple extension that check if the array that you give is in the current array (self)