by solutionyogi · 12y ago · 0 comments
Unlike C and Objective-C, Swift enumeration members are not assigned a default integer value when they are created. In the CompassPoints example above, North, South, East and West do not implicitly equal 0, 1, 2 and 3. Instead, the different enumeration members are fully-fledged values in their own right, with an explicitly-defined type of CompassPoint.
+100 for that. This will help developer avoid whole class of bugs.
Enumerations also support associated values. Enums in .NET are very poorly defined. Looks like Swift got it right.
http://en.wikipedia.org/wiki/C++11#Strongly_typed_enumeratio...
Well that’s gonna make storing persistent values tricky.