Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Mixed type arrays, anybody?

Did you notice something there? Look at these lines again:

myCoordinates.append(myCartesianPosition) 
myCoordinates.append(myPolarPosition)

Using an enum as an array type, [someEnum], we can store different types, using the associated types mechanism, within one Array.

And all of that in complete type-safety.