True. <br>In my proposal I mention how NS_STRING_ENUM doesn't produce an swift enum.<br><br>So one solution is to merely "go the other way" which would produce what Kevin N. suggested. <br><br>Is it not odd that that the objc version is so different from the swift version?<br><br>Would it not be better to offer a somewhat similar API experience between the two languages?<br><br>@objcstring would "promote" the swift enum to an objective-c class to make the API experience similar.<br><br>I understand that maybe @objcstring is too niche to get its own annotation. Instead @objc should become more powerful.<br><br>I think @objc should make an enum become a class with swift-enum like abilities. This would allow enum functions to be bridged over to objective-c as well.<br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 21, 2017 at 1:32 PM Michael Ilseman <<a href="mailto:milseman@apple.com">milseman@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">A quick note addressing a misconception that you’ll want to clean up for a formal proposal:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">NS_[EXTENSIBLE_]STRING_ENUMs both generate Swift structs, the difference is only in the explicitness of the rawValue initializer. To use the “other direction” analogy, you’d similarly want them to apply for rawValue-ed structs alone. The reasons are the same: only the structs are layout-compatible because enums are integers.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Once you go down this route, perhaps it doesn’t make sense to annotate the struct decls themselves anymore. Maybe you just want more @objc control over bridging the types. For example, maybe you want to introduce a feature so that static members that are layout-compatible with String are bridged as global strings with the supplied name.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"></blockquote></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Feb 20, 2017, at 4:07 PM, Derrick Ho via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_8141121511202417595Apple-interchange-newline gmail_msg"></blockquote></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">Swift should not forsake objective-c. At least not when it comes enum strings. Although swift enums are suppose to be swift only, I think we should add a new attribute to slightly relax that. I think a good attribute would be @objcstring.</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">By adding @objcstring, an objective-c exclusive class will be generated.</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">@objcstring</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">enum Planet {</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"> case Jupiter</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">}</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">I have written up a proposal with more details on what it would look for objective-c.</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><a href="https://github.com/wh1pch81n/swift-evolution/blob/swift-enum-objc/proposals/NNNN-Swift-enum-strings-ported-to-Objective-c.md" class="gmail_msg" style="word-spacing:1px" target="_blank">https://github.com/wh1pch81n/swift-evolution/blob/swift-enum-objc/proposals/NNNN-Swift-enum-strings-ported-to-Objective-c.md</a><br class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">If no one objects to this proposal I'll submit it.</div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(49,49,49);word-spacing:1px">**notes: I am reviving this discussion so that I may submit this for Swift 4 stage 2</div></div></div></blockquote></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">
_______________________________________________<br class="gmail_msg">swift-evolution mailing list<br class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"></div></blockquote></div></div></blockquote></div>