Why can I have an [AnyObject] array and put a bunch of different sized types in it ...
var a = [AnyObject]()
a.append(Int(1))
a.append(Float64(3
Because Int is a value Type.
AnyObject refers to referance types (classes) not value types
Any refers to referance types + value types (structs + classes)
You must use Any for valueTypes, not AnyObject
Value Types > generally structs, enums, bla bla..
Referance Types > generally classes
There are two types of variables > Referance types and value types
Referance types are pointer types and generally contains a ram address value where the original data is stored
Value types are not addresses . They directly contain the variable value
Int asd = 3 (asd directly contains 3)
Int, Float, number types,... Date are almost always struct(value type) in most computer languages.
String is almost always a hybrid in most computer languages
ViewControllers, Views, Buttons, ...arrays, dictionaries, ... and your custom defined classes are referance types