Check if an element is in array
let result = sourceArray.filter { $0.attributeCompared? == valueCompared } if result.isEmpty { //not in array } else{ //in array }