I'm not part of the core team, of course, but I like this change in principle.
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? > On 31 Dec 2016, at 4:15 am, Derrick Ho via swift-evolution > <[email protected]> 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 <[email protected]> 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"; > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
