Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-03-05 Thread Derrick Ho via swift-evolution
Thank you all for your input, I have revised the proposal to merely "go the other way". It will allow Swift API developers to make enum strings available to objective-c as global strings. https://github.com/wh1pch81n/swift-evolution/blob/swift-enum-objc/proposals/-Swift-enum-strings-ported-to

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-27 Thread Zach Waldowski via swift-evolution
I don't understand the question. It should turn it into a group of NSStrings prefixed by a common name. That's how they're imported from Objective-C, stripped of their common prefix. Sincerely, Zachary Waldowski z...@waldowski.me On Mon, Feb 27, 2017, at 05:02 PM, Derrick Ho via swift-

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-27 Thread Derrick Ho via swift-evolution
NS_EXTENSIBLE_STRING_ENUM Turns a groups of NSStrings into a struct. What do you suggest for the reverse? On Mon, Feb 27, 2017 at 4:39 PM Zach Waldowski via swift-evolution < swift-evolution@swift.org> wrote: > -1 as written due to the impedance mismatch with importing NS_STRING_ENUM > and NS_EXT

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-27 Thread Zach Waldowski via swift-evolution
-1 as written due to the impedance mismatch with importing NS_STRING_ENUM and NS_EXTENSIBLE_STRING_ENUM. Exporting to Objective-C should export a typedef and several constants, not a class. Exporting generated accessors to Objective-C is unnecessary as you have -isEqual: and -hashValue on NSString

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-26 Thread Derrick Ho via swift-evolution
I updated my proposal to reflect the community's desire to build on @objc instead of adding a new attribute @objcstring. I've included it below for convenience: Swift Enu

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-21 Thread Derrick Ho via swift-evolution
True. In my proposal I mention how NS_STRING_ENUM doesn't produce an swift enum. So one solution is to merely "go the other way" which would produce what Kevin N. suggested. Is it not odd that that the objc version is so different from the swift version? Would it not be better to offer a somewha

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-21 Thread Michael Ilseman via swift-evolution
A quick note addressing a misconception that you’ll want to clean up for a formal proposal: 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

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-20 Thread Derrick Ho via swift-evolution
I like how the Enum version looks @objc enum Planet: String {} But it looks odd for structs @objc struct Planet: String {} What do you think we should use? On Mon, Feb 20, 2017 at 8:05 PM Derrick Ho wrote: > Swift Enum strings should not translate into objective c global static > strings. > >

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-20 Thread Derrick Ho via swift-evolution
Swift Enum strings should not translate into objective c global static strings. As I wrote in my proposal ( https://github.com/wh1pch81n/swift-evolution/blob/swift-enum-objc/proposals/-Swift-enum-strings-ported-to-Objective-c.md ) , we need to support a failable initializer. I chose @objcst

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-20 Thread Xiaodi Wu via swift-evolution
Agree. If technical limitations do not prohibit it, Kevin's idea seems the more elegant. On Mon, Feb 20, 2017 at 6:28 PM, Kevin Nattinger via swift-evolution < swift-evolution@swift.org> wrote: > I don’t think we need/want to add `@objcstring` or anything like that, but > I do think we should le

Re: [swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-20 Thread Kevin Nattinger via swift-evolution
I don’t think we need/want to add `@objcstring` or anything like that, but I do think we should let String enums be @objc (currently it’s int types only) and imported as const refs. // Already works @objc enum IntEnum: Int { case foo = 1 case bar = 2 } // "not an integer type" // Should

[swift-evolution] [pitch] Make swift enum string available to Objc

2017-02-20 Thread Derrick Ho via swift-evolution
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. By adding @objcstring, an objective-c exclusive class wi