<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Right. This is because Swift can't tell if your enum is actually an option set, a true, non-overlapping enum, or just a set of related constants, so it picks the lowest common denominator. We currently don't have a great way to override that in headers you don't control.</div><div class=""><br class=""></div><div class="">(Heck, on non-Apple platforms we don't have a great way to do it in headers you do control; Swift is currently keying off the macro names.)</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 10, 2016, at 13:25 , Austin Zheng via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I spoke too soon, the cases are also defined as values of that type. So, a working version of your code:</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);"><span class="" style="color: rgb(187, 44, 162);">extension</span><span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">fe_type</span><span class="" style=""><span class="Apple-converted-space"> </span>:<span class="Apple-converted-space"> </span></span>CustomStringConvertible<span class="" style=""><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">public</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(187, 44, 162);">var</span><span class="Apple-converted-space"> </span>description:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">String</span><span class="Apple-converted-space"> </span>{</div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>switch<span class="" style=""><span class="Apple-converted-space"> </span></span>self<span class="" style=""><span class="Apple-converted-space"> </span>{</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>case<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">FE_QPSK</span><span class="" style="">:<span class="Apple-converted-space"> </span></span>return<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(209, 47, 27);">"QPSK"</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>case<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">FE_QAM</span><span class="" style="">:<span class="Apple-converted-space"> </span></span>return<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(209, 47, 27);">"QAM"</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>case<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">FE_OFDM</span><span class="" style="">:<span class="Apple-converted-space"> </span></span>return<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(209, 47, 27);">"OFDM"</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);"><span class="" style=""> <span class="Apple-converted-space"> </span></span>case<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(79, 129, 135);">FE_ATSC</span><span class="" style="">:<span class="Apple-converted-space"> </span></span>return<span class="" style=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(209, 47, 27);">"ATSC"</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);"><span class="" style=""> <span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(187, 44, 162);">default</span><span class="" style="">:<span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(61, 29, 129);">fatalError</span><span class="" style="">(</span>"can't be exhaustive"<span class="" style="">)</span></div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;"> }</div><div class="" style="margin: 0px; font-size: 14px; line-height: normal; font-family: Menlo;">}</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Austin</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 10, 2016, at 1:22 PM, Austin Zheng <<a href="mailto:austinzheng@gmail.com" class="">austinzheng@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">Hi Ryan,</div><div class=""><br class=""></div><div class="">Apologies, I should have been more clear. In Xcode you can alt(?)-click on a type (e.g the 'MyType' in "let a : MyType = 123") in the IDE to pop up a little window that shows you the definition, including the type and some other information. If you're on a Linux box or not using an IDE you probably don't have that option.</div><div class=""><br class=""></div><div class="">The only methods I see exposed on the Swift imported type are initializers taking a integer raw value, and a 'rawValue' property for getting back out the raw value. Hope that helps.</div><div class=""><br class=""></div><div class="">Austin</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 10, 2016, at 1:18 PM, Ryan Lovelett <<a href="mailto:swift-dev@ryan.lovelett.me" class="">swift-dev@ryan.lovelett.me</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="">Austin,<br class=""></div><div class=""> </div><div class="">I guess I should say that the `typedef` is coming from a<span class="Apple-converted-space"> </span><a href="http://lxr.free-electrons.com/source/include/linux/dvb/frontend.h?v=3.2" class="">Linux kernel header</a>. So I don't think I'm going to be able to add any macros to the definition.<br class=""></div><div class=""> </div><div class="">What do you mean about alt-click? Alt click where?<br class=""></div><div class=""> </div><div class="">On Sun, Jan 10, 2016, at 04:12 PM, Austin Zheng wrote:<br class=""></div><blockquote type="cite" class=""><div class="">fe_type is being imported as a struct (alt-click 'fe_type' in Swift). I think if you want it to be imported as an enum you need to use the NS_ENUM macro in the definition, which might not be possible in your case.<br class=""></div><div class=""> </div><div class=""><div class="">Austin<br class=""></div><div class=""><div class=""> </div><div class=""><blockquote type="cite" class=""><div class="">On Jan 10, 2016, at 1:06 PM, Ryan Lovelett via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:<br class=""></div><div class=""> </div><div class=""><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;">typedef enum fe_type {</span></span><br class=""></div><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;"> FE_QPSK,</span></span><br class=""></div><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;"> FE_QAM,</span></span><br class=""></div><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;"> FE_OFDM,</span></span><br class=""></div><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;"> FE_ATSC</span></span><br class=""></div><div class=""><span class="font" style="font-family: Helvetica;"><span class="size" style="font-size: 12px;">} fe_type_t;</span></span><br class=""></div></div></blockquote></div></div></div></blockquote><div class=""> </div></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSAZ0SOMiT5GTitpQSBtOXxagO82bM7m5nzYLlkJD3jLcpFtKvKauMEh5C2u8qX7gUzZ0DCvhQLAg-2BFqUhpb5Vm6Imy7ipkPaorgV7Atq6-2FD1s-2BaCDk-2BEtCka0ZdgGt6DOu-2Bsn-2FEZ8JAVqg8E6AoY72uj3di8mbR1TrgFmfrh1b27RMIGCYqSXmV7cVPcigiOnI-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span></span><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-dev@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-dev@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a></div></blockquote></div><br class=""></body></html>