[swift-evolution] [Proposal] Enum string interoperability with Objective-C and Swift

Derrick Ho wh1pch81n at gmail.com
Sat Dec 31 11:56:13 CST 2016


Anyone on the core team like to say anything?
On Fri, Dec 30, 2016 at 9:15 AM Derrick Ho <wh1pch81n at gmail.com> wrote:

> I'm trying to revive an old thread. I'd like to hear from the community.
>
> Can we make a swift enum string interoperable with Objective-C?
>
> Currently NS_STRING_ENUM ports from objective-c to swift but not the other
> way around.
>
> I feel that if you can go one direction you should be able to go back.
>
> @objc
> enum City: String {
> case NewYork = "New York"
> }
>
> Make this available as a global string in objective -c ?
> On Wed, Nov 23, 2016 at 5:55 AM Derrick Ho <wh1pch81n at gmail.com> wrote:
>
> 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";
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161231/c7667529/attachment.html>


More information about the swift-evolution mailing list