Re: Trouble with imported enums in Swift

2014-10-21 Thread Raglan T. Tiger
On Oct 20, 2014, at 10:53 PM, Rick Mann rm...@latencyzero.com wrote: Sigh, I figured it out. Not only do you have to use NS_ENUM, the enumeration members MUST begin with the name of the enumeration. Example please ... I feel unfulfilled. -rags

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
On Oct 21, 2014, at 09:18 , Raglan T. Tiger r...@crusaderrabbit.net wrote: On Oct 20, 2014, at 10:53 PM, Rick Mann rm...@latencyzero.com wrote: Sigh, I figured it out. Not only do you have to use NS_ENUM, the enumeration members MUST begin with the name of the enumeration.

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
On Oct 21, 2014, at 11:38 AM, Rick Mann rm...@latencyzero.com wrote: On Oct 21, 2014, at 09:18 , Raglan T. Tiger r...@crusaderrabbit.net wrote: On Oct 20, 2014, at 10:53 PM, Rick Mann rm...@latencyzero.com wrote: Sigh, I figured it out. Not only do you have to use NS_ENUM, the

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
On Oct 21, 2014, at 13:13 , Greg Parker gpar...@apple.com wrote: NS_ENUM or NS_OPTIONS is required for Swift to import it. The name prefix is not required. If I recall correctly, the Swift importer has some heuristics to omit any shared prefix from the Swift names, but if there is no

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 13:33 , Rick Mann rm...@latencyzero.com wrote: Honestly, though, I don't see why Swift can't just deal with plain enums. Because it’s not an Obj-C compiler? I suspect that the reason you saw the “incomplete” behavior is that you declared the enum in two parts: enum

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
On Oct 21, 2014, at 14:26 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Oct 21, 2014, at 13:33 , Rick Mann rm...@latencyzero.com wrote: Honestly, though, I don't see why Swift can't just deal with plain enums. Because it’s not an Obj-C compiler? I suspect that the

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 14:35 , Rick Mann rm...@latencyzero.com wrote: On Oct 21, 2014, at 14:26 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: Honestly, though, I don’t see why you can’t just deal with writing enums the “compatible” way. Because the file whence it comes is

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
On Oct 21, 2014, at 14:54 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Oct 21, 2014, at 14:35 , Rick Mann rm...@latencyzero.com wrote: On Oct 21, 2014, at 14:26 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: Honestly, though, I don’t see why you can’t

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 16:25 , Rick Mann rm...@latencyzero.com wrote: But the names of the elements all have to start with the type name, and that means not only changing the entire code base that uses the header, but also changing the naming convention used by that code base. Sure, we can do

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
On Oct 21, 2014, at 4:25 PM, Rick Mann rm...@latencyzero.com wrote: But the names of the elements all have to start with the type name This should not be the case. Please provide an example of the ObjC and Swift code you're using. Here's mine: // ObjC header: no type name prefix on

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
I've created a sample project showing the behavior and submitted it with radar #18730653. On Oct 21, 2014, at 17:09 , Greg Parker gpar...@apple.com wrote: On Oct 21, 2014, at 4:25 PM, Rick Mann rm...@latencyzero.com wrote: But the names of the elements all have to start with the type

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
On Oct 21, 2014, at 5:45 PM, Rick Mann rm...@latencyzero.com wrote: I've created a sample project showing the behavior and submitted it with radar #18730653. Thanks for the bug report. There is a Swift importer bug here. Your enumerators all have a common name prefix, but that name prefix

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
On Oct 21, 2014, at 18:13 , Greg Parker gpar...@apple.com wrote: On Oct 21, 2014, at 5:45 PM, Rick Mann rm...@latencyzero.com wrote: I've created a sample project showing the behavior and submitted it with radar #18730653. Thanks for the bug report. There is a Swift importer bug

Trouble with imported enums in Swift

2014-10-20 Thread Rick Mann
I'm having weird trouble using a C enumeration imported via bridging header from swift. I can define an instance variable and initialize it using the enum, but I can't compare the enum: Camera.swift:60:18: Cannot invoke '==' with an argument list of type '(@lvalue McpSweepState,

Re: Trouble with imported enums in Swift

2014-10-20 Thread Roland King
On 21 Oct 2014, at 10:03 am, Rick Mann rm...@latencyzero.com wrote: I'm having weird trouble using a C enumeration imported via bridging header from swift. I can define an instance variable and initialize it using the enum, but I can't compare the enum: Camera.swift:60:18: Cannot

Re: Trouble with imported enums in Swift

2014-10-20 Thread Rick Mann
On Oct 20, 2014, at 19:17 , Roland King r...@rols.org wrote: well one is ‘==‘ and the other is ‘=‘ so not totally shocked there’s no error in the second one. Well, okay, but == sure is getting confused, but = sees the two types as compatible. Have you tried 1) a switch Type

Re: Trouble with imported enums in Swift

2014-10-20 Thread Roland King
On 21 Oct 2014, at 10:23 am, Rick Mann rm...@latencyzero.com wrote: On Oct 20, 2014, at 19:17 , Roland King r...@rols.org wrote: well one is ‘==‘ and the other is ‘=‘ so not totally shocked there’s no error in the second one. Well, okay, but == sure is getting confused, but = sees

Re: Trouble with imported enums in Swift

2014-10-20 Thread Rick Mann
Sigh, I figured it out. Not only do you have to use NS_ENUM, the enumeration members MUST begin with the name of the enumeration. On Oct 20, 2014, at 19:43 , Roland King r...@rols.org wrote: On 21 Oct 2014, at 10:23 am, Rick Mann rm...@latencyzero.com wrote: On Oct 20, 2014, at 19:17