I have an array of custom class [CustomClass]. I am trying to convert it to [AnyObject].
self.customClassArray = self.anyObjectArray as [AnyObject]
I get the following errors:
'AnyObject' is not a subtype of 'CustomClass'
and
Cannot convert value of type '[CustomClass]' to type '[AnyObject]' in coercion.
What am I missing?
There is basically no scenario where you would have to cast your
CustomClasstoAnyObject.Your custom class is a subtype of
AnyObjectand not the other way around, therefore any function that requires anAnyObjectwill be able to handle yourCustomClass