<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">In your example, you don't prepend the prefix but the whole name (JRKCity), so we don’t need to define what the prefix is.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 5 janv. 2017 à 20:13, Jeff Kelley via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Would that prepend the prefix on individual members? If so that’s perfect!</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div style="font-family:Helvetica" class=""><br class=""></div><div style="font-family:Helvetica" class="">Jeff Kelley</div><div style="font-family:Helvetica" class=""><br class=""></div><div style="font-family:Helvetica" class=""><a href="mailto:SlaunchaMan@gmail.com" style="color:rgb(17,85,204)" target="_blank" class="">SlaunchaMan@gmail.com</a> | <a href="https://twitter.com/SlaunchaMan" style="color:rgb(17,85,204)" target="_blank" class="">@SlaunchaMan</a> | <a href="http://jeffkelley.org/" style="color:rgb(17,85,204)" target="_blank" class="">jeffkelley.org</a></div></div></div></div>
<br class=""><div class="gmail_quote">On Thu, Jan 5, 2017 at 2:01 PM, Xiaodi Wu <span dir="ltr" class=""><<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is there a reason you're unsatisfied with `@objc(JRKCity)`?<div class="HOEnZb"><div class="h5"><br class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Jan 5, 2017 at 12:48 Jeff Kelley via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_-1598411921042367741gmail_msg">Since it’s still common to see prefixes in use in Objective-C, I wonder if we could add that with a new attribute:<div class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div><div class="m_-1598411921042367741gmail_msg"><font face="monospace, monospace" class="m_-1598411921042367741gmail_msg">@objcprefix(JRK) enum City: String {</font></div></div><div dir="ltr" class="m_-1598411921042367741gmail_msg"><div class="m_-1598411921042367741gmail_msg"><font face="monospace, monospace" class="m_-1598411921042367741gmail_msg"><span class="m_-1598411921042367741m_-9129368756442101266Apple-tab-span m_-1598411921042367741gmail_msg" style="white-space:pre-wrap">        </span>case NewYork = "New York"</font></div><div class="m_-1598411921042367741gmail_msg"><font face="monospace, monospace" class="m_-1598411921042367741gmail_msg">}</font></div><div class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div></div><div dir="ltr" class="m_-1598411921042367741gmail_msg"><div class="m_-1598411921042367741gmail_msg">Would then appear in Objective-C as:</div><div class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div><div class="m_-1598411921042367741gmail_msg"><font face="monospace, monospace" class="m_-1598411921042367741gmail_msg">typedef NSString * JRKCity;</font></div><div class="m_-1598411921042367741gmail_msg"><font face="monospace, monospace" class="m_-1598411921042367741gmail_msg">static JRKCity const JRKCityNewYork = @"New York";</font></div><div class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div><div class="m_-1598411921042367741gmail_msg">It’s a minor tweak, but would help especially with mixed-language source code where the Objective-C code is still prefixed.</div><div class="gmail_extra m_-1598411921042367741gmail_msg"><br clear="all" class="m_-1598411921042367741gmail_msg"><div class="m_-1598411921042367741gmail_msg"><div class="m_-1598411921042367741m_-9129368756442101266gmail_signature m_-1598411921042367741gmail_msg" data-smartmail="gmail_signature"><div dir="ltr" class="m_-1598411921042367741gmail_msg"><div style="font-family:Helvetica" class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div><div style="font-family:Helvetica" class="m_-1598411921042367741gmail_msg">Jeff Kelley</div><div style="font-family:Helvetica" class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></div><div style="font-family:Helvetica" class="m_-1598411921042367741gmail_msg"><a href="mailto:SlaunchaMan@gmail.com" style="color:rgb(17,85,204)" class="m_-1598411921042367741gmail_msg" target="_blank">SlaunchaMan@gmail.com</a> | <a href="https://twitter.com/SlaunchaMan" style="color:rgb(17,85,204)" class="m_-1598411921042367741gmail_msg" target="_blank">@<wbr class="">SlaunchaMan</a> | <a href="http://jeffkelley.org/" style="color:rgb(17,85,204)" class="m_-1598411921042367741gmail_msg" target="_blank">jeffkelley.org</a></div></div></div></div></div></div><div dir="ltr" class="m_-1598411921042367741gmail_msg"><div class="gmail_extra m_-1598411921042367741gmail_msg">
<br class="m_-1598411921042367741gmail_msg"><div class="gmail_quote m_-1598411921042367741gmail_msg">On Wed, Jan 4, 2017 at 5:51 PM, Derrick Ho via swift-evolution <span dir="ltr" class="m_-1598411921042367741gmail_msg"><<a href="mailto:swift-evolution@swift.org" class="m_-1598411921042367741gmail_msg" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br class="m_-1598411921042367741gmail_msg"><blockquote class="gmail_quote m_-1598411921042367741gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The underline can be omitted. To remain more consistent. <br class="m_-1598411921042367741gmail_msg"><span class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"> enum City: String {<br class="m_-1598411921042367741gmail_msg"> case NewYork = "New York"<br class="m_-1598411921042367741gmail_msg"> } <br class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"></span> typedef NSString * City;<br class="m_-1598411921042367741gmail_msg"> static City const CityNewYork = @"New York";<div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266HOEnZb"><div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266h5"><br class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"><br class="m_-1598411921042367741gmail_msg"><div class="gmail_quote m_-1598411921042367741gmail_msg"><div dir="ltr" class="m_-1598411921042367741gmail_msg">On Wed, Jan 4, 2017 at 2:22 PM Rod Brown <<a href="mailto:rodney.brown6@icloud.com" class="m_-1598411921042367741gmail_msg" target="_blank">rodney.brown6@icloud.com</a>> wrote:<br class="m_-1598411921042367741gmail_msg"></div><blockquote class="gmail_quote m_-1598411921042367741gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">I'm not part of the core team, of course, but I like this change in principle.</div><div id="m_-1598411921042367741m_-9129368756442101266m_726753818258568081m_1459424563651473008AppleMailSignature" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"></div><div id="m_-1598411921042367741m_-9129368756442101266m_726753818258568081m_1459424563651473008AppleMailSignature" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">My one concern in this case would be choosing a naming convention for the back port that makes sense both ways. The naming convention you propose ( EnumName_EnumCase) seems inconsistent with the current import of strings from Obj-C to Swift. Could we find a way to unify them?</div></div><div dir="auto" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">On 31 Dec 2016, at 4:15 am, Derrick Ho via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"></div><blockquote type="cite" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">I'm trying to revive an old thread. I'd like to hear from the community.<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">Can we make a swift enum string interoperable with Objective-C?<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">Currently NS_STRING_ENUM ports from objective-c to swift but not the other way around.<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">I feel that if you can go one direction you should be able to go back.<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">@objc<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">enum City: String {<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"> case NewYork = "New York"<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">} <br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">Make this available as a global string in objective -c ?<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div class="gmail_quote m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div dir="ltr" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">On Wed, Nov 23, 2016 at 5:55 AM Derrick Ho <<a href="mailto:wh1pch81n@gmail.com" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg" target="_blank">wh1pch81n@gmail.com</a>> wrote:<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"></div><blockquote class="gmail_quote m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="white-space:pre-wrap" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">I think enum strings should gain better interoperability with swift. Something like this:
enum City: String {
case NewYork = "New York"
}
This can be ported over to Objective-c like this:
typedef NSString * City;
static City const City_NewYork = @"New York";<br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"></div>
</blockquote></div>
</div></blockquote></div><div dir="auto" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><blockquote type="cite" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><div class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><span class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">______________________________<wbr class="">_________________</span><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><span class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg">swift-evolution mailing list</span><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><span class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><a href="mailto:swift-evolution@swift.org" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><span class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg" target="_blank">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a></span><br class="m_-1598411921042367741gmail_msg m_-1598411921042367741m_-9129368756442101266m_726753818258568081gmail_msg"></div></blockquote></div></blockquote></div>
</div></div><br class="m_-1598411921042367741gmail_msg">______________________________<wbr class="">_________________<br class="m_-1598411921042367741gmail_msg">
swift-evolution mailing list<br class="m_-1598411921042367741gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="m_-1598411921042367741gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-1598411921042367741gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-1598411921042367741gmail_msg" target="_blank">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="m_-1598411921042367741gmail_msg">
<br class="m_-1598411921042367741gmail_msg"></blockquote></div><br class="m_-1598411921042367741gmail_msg"></div></div>
______________________________<wbr class="">_________________<br class="m_-1598411921042367741gmail_msg">
swift-evolution mailing list<br class="m_-1598411921042367741gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="m_-1598411921042367741gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-1598411921042367741gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-1598411921042367741gmail_msg" target="_blank">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class="m_-1598411921042367741gmail_msg">
</blockquote></div>
</div></div></blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>