Re: Trouble with imported enums in Swift
Re: Trouble with imported enums in Swift
- Subject: Re: Trouble with imported enums in Swift
- From: Rick Mann <email@hidden>
- Date: Tue, 21 Oct 2014 13:33:23 -0700
> On Oct 21, 2014, at 13:13 , Greg Parker <email@hidden> 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 the enumerators are imported unchanged.
I guess I'm going to have to make a demo project to show that this isn't precisely true.
If I make a "plain" enum in C, Swift recognizes it for the purposes of creating a type, and for assignment. It will not, however, allow comparisons with those values.
If I use NS_ENUM without also prefixing each member with the enum's type name, Swift will not allow comparisons.
Only if I use NS_ENUM and prefix each member with the type name will Swift fully support the enum.
Honestly, though, I don't see why Swift can't just deal with "plain" enums.
--
Rick Mann
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden