Swift Value vs. Reference Type, strike again

And again I stumbled upon a small gotcha related to the difference of value and reference type in Swift. This time it is about Array and init(count:repeatedValue:)

Have a look at following Gist

What are the results of line 16 and 17. Both lines should return false right?

Nope. Line 16 returns false, where line 17 returns true. 😖

This is due to the fact that Person1 is a struct, so by repeating the value of this struct we create an array of 10 separate instances of Person1.

Person2 is however a class and repeated value is the reference. So people2 is an array of references to the same instance.