Non-contiguous Enum Values
This is a feature of Swift Enumerations I did not know about. Clever.
Often values like status codes are tiered like HTTP status codes which are grouped together within a range and incremented by one for most values in that group. Reducing code which must be typed is a good practice with Swift and eliminating the need to set every value in an enum definition would be a great way to eliminate details which can be derived by convention.
For this example the HTTP Status Codes are used. Tiers are grouped at increments of 100 and most values within one of the previous before the next level. If the value is not specified it would simply be one more than the previous value.
A common practice with enum types is to start with defining the first value with 0 and incrementing each value by one for the rest of the values.
Hi, thanks for the StatusCodes.
This is a Swift4 valid version of your code: