What is the difference between Any and AnyObject in Swift

What are Any and AnyObject



Any and AnyObject are special types for working with nonspecific types.

Using Any and AnyObject is not recommended and it is always better to be specific about the types you work with.

AnyObject

Can represent an instance of any Class type

Any

Can represent an instance of any type including function types

Leave a Reply

Your email address will not be published. Required fields are marked *