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
}
------------------------------------------------------------
Imported via bridging header:
enum McpSweepState
{
MCP_SWEEP_UNKNOWN = 0,
MCP_SWEEP_EMPTY = 1,
MCP_SWEEP_ROTATING = 2,
MCP_SWEEP_PROCESSING = 3,
MCP_SWEEP_COMPLETE = 4,
MCP_SWEEP_CANCELED = 5,
MCP_SWEEP_ABORTED_PHYSICAL = 6,
MCP_SWEEP_ABORTED_DATA = 7,
MCP_SWEEP_ERROR = 8,
};
typedef enum McpSweepState McpSweepState;
enum McpCameraState
{
MCP_STATE_UNKNOWN = 0,
MCP_STATE_READY = 1,
MCP_STATE_SWEEP_IN_PROGRESS = 2,
MCP_STATE_BLOCKED = 3,
};
typedef enum McpCameraState McpCameraState;
--
Rick Mann
[email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]