This will check "if arrProducts contain any of 3 custom class objects".
let isContainingAnyOf3CustomClassObject =
arrProducts.contains {$0 is Article || $0 is Flower || $0 is Chocolate}
//->true
If you need to retrieve all elements of any 3 types, you can use filter
.
let elementsOfAny3Types = arrProducts.filter {$0 is Article || $0 is Flower || $0 is Chocolate}
If you want the first element, you can use first
.
let firstElementOfAny3Types = arrProducts.filter {$0 is Article || $0 is Flower || $0 is Chocolate}.first
But this may be more efficient:
if let firstMatchingIndex = arrProducts.indexOf({$0 is Article || $0 is Flower || $0 is Chocolate}) {
let firstMatchingElement = arrProducts[firstMatchingIndex]
print(firstMatchingElement)
}
If any above are not what you mean, you need to modify your question and describe what you really want to achieve more precisely.