What type is .MediumStyle?

When we write


what is the type of .MediumStyle and .ShortStyle?


doesn’t work because the compiler thinks I’m trying to call .MediumStyle on whatever came before.

Is this a Swift feature? Where can I find more about how these are used in other contexts?

That is how Swift imports enumerations from Objective-C that have a common prefix.

Straight from the documentation for [b]NSDateFormatterStyle[/b]:

The following constants specify predefined format styles for dates and times.


enum NSDateFormatterStyle : UInt { case NoStyle case ShortStyle case MediumStyle case LongStyle case FullStyle }

typedef enum { NSDateFormatterNoStyle = kCFDateFormatterNoStyle, NSDateFormatterShortStyle = kCFDateFormatterShortStyle, NSDateFormatterMediumStyle = kCFDateFormatterMediumStyle, NSDateFormatterLongStyle = kCFDateFormatterLongStyle, NSDateFormatterFullStyle = kCFDateFormatterFullStyle } NSDateFormatterStyle;