> 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 invoke '==' with an argument list of type 
> '(@lvalue McpSweepState, McpSweepState)'
> 
> The code is here:
> 
> class
> MyClass
> {
>    func
>    getCameraState()
>        -> McpCameraState
>    {
>        if mSweepState == MCP_SWEEP_UNKNOWN            //  <---- error here
>        {
>            return MCP_STATE_SWEEP_IN_PROGRESS;
> 
>        }
>        else
>        {
> 
>            return MCP_STATE_READY;
>        }
> 
>    }
> 
>    var mSweepState: McpSweepState    = MCP_SWEEP_UNKNOWN; // <--- no error
> }
> 
> —


well one is ‘==‘ and the other is ‘=‘ so not totally shocked there’s no error 
in the second one. 

Have you tried

1) a switch
2) using .MCP_SWEEP_UNKNOWN or an even more totally qualified name 
McpSweepState.MCP_SWEEP_UNKNOWN
3) if !( mSweepState != MCP_SWEEP_UNKNOWN )  // I know you think I’m joking but 
I’m not





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to