Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
> On Oct 21, 2014, at 18:13 , Greg Parker wrote: > > >> On Oct 21, 2014, at 5:45 PM, Rick Mann 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

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
> On Oct 21, 2014, at 5:45 PM, Rick Mann 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 differs from the

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 wrote: > > >> On Oct 21, 2014, at 4:25 PM, Rick Mann wrote: >> >> But the names of the elements all have to start with the type name > > This should not be the

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
> On Oct 21, 2014, at 4:25 PM, Rick Mann 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 enumerators typed

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 16:25 , Rick Mann 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 it, > but it'll i

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
> On Oct 21, 2014, at 14:54 , Quincey Morris > wrote: > > On Oct 21, 2014, at 14:35 , Rick Mann wrote: >> >>> On Oct 21, 2014, at 14:26 , Quincey Morris >>> wrote: >>> >>> Honestly, though, I don’t see why you can’t just deal with writing enums >>> the “compatible” way. >> >> Because the

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 14:35 , Rick Mann wrote: > >> On Oct 21, 2014, at 14:26 , Quincey Morris >> 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 part of a library of C++ code that also > ha

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
> On Oct 21, 2014, at 14:26 , Quincey Morris > wrote: > > On Oct 21, 2014, at 13:33 , Rick Mann 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

Re: Trouble with imported enums in Swift

2014-10-21 Thread Quincey Morris
On Oct 21, 2014, at 13:33 , Rick Mann 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 McpSweepState > { >

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
> On Oct 21, 2014, at 13:13 , Greg Parker 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 prefix then

Re: Trouble with imported enums in Swift

2014-10-21 Thread Greg Parker
> On Oct 21, 2014, at 11:38 AM, Rick Mann wrote: > >> On Oct 21, 2014, at 09:18 , Raglan T. Tiger wrote: >> >>> On Oct 20, 2014, at 10:53 PM, Rick Mann 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 enu

Re: Trouble with imported enums in Swift

2014-10-21 Thread Rick Mann
> On Oct 21, 2014, at 09:18 , Raglan T. Tiger wrote: > > > > >> On Oct 20, 2014, at 10:53 PM, Rick Mann 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 unfulf

Re: Trouble with imported enums in Swift

2014-10-21 Thread Raglan T. Tiger
> On Oct 20, 2014, at 10:53 PM, Rick Mann 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 ___ Cocoa-dev m

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 wrote: > > >> On 21 Oct 2014, at 10:23 am, Rick Mann wrote: >> >> >>> On Oct 20, 2014, at 19:17 , Roland King wrote: >

Re: Trouble with imported enums in Swift

2014-10-20 Thread Roland King
> On 21 Oct 2014, at 10:23 am, Rick Mann wrote: > > >> On Oct 20, 2014, at 19:17 , Roland King 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 > co

Re: Trouble with imported enums in Swift

2014-10-20 Thread Rick Mann
> On Oct 20, 2014, at 19:17 , Roland King 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 'McpSweepState

Re: Trouble with imported enums in Swift

2014-10-20 Thread Roland King
> On 21 Oct 2014, at 10:03 am, Rick Mann 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 invoke '==' with an

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, McpSweepState)'