I get the following error: Binary operator '===' cannot be applied to operands of type 'Self.Element' and 'AnyObject' on the line: return contains { $0 === object }
.
Is there a way to cast object
to the type of Iterator.Element
? Does the line where Iterator.Element: AnyObject
not mean that that the Iterator.Element
must be representable as AnyObject
?
extension Sequence where Iterator.Element: AnyObject {
/**
- Parameter object:
*/
func containsObjectIdentical(to object: AnyObject) -> Bool {
return contains { $0 === object }
}
}
Thanks for any help on this matter.