Type Casting For AnyObject to represent instances of any reference type
<pre><code> var array = [AnyObject]()
 struct Test {}
 array.append(Test())
</code></pre>

<p>When I write this code in the play ground it gives me the following error <strong>Type 'Test' does not conform to protocol 'AnyObject'</strong></p>

<p>I am guessing it is failing because struct is a value type not a reference type. 
But when I run this code </p>

<pre><code>var array = [AnyObject]()
array.append(1)
array.append(2.0)
array.append("3")
</code></pre>

<p>It works
but these are all also value types but in this case no error is given <strong>Why?</strong> </p>