Combine objective-c enum in swift -


After

I am using the Vehicle Fitness API (which is in Objective-C) in my fast application I am trying to combine bitwise multiple items with enum which is not NS_ENUM. It is defined as:

  typedef enum {/ ** specifies non-existent sensor * / WF_SENSORTYPE_NONE = 0, / ** specifies bike power sensor * / WF_SENSORTYPE_BIKE_POWER = 0x00000001, / ** Specifies the bike speed sensor. * / WF_SENSORTYPE_BIKE_SPEED = 0x00000002, / ** Specifies the bike cadence sensor. * / WF_SENSORTYPE_BIKE_CADENCE = 0x00000004, ...} WFSensorType_t; As a result of the following:  'WFSensorType_t' is not convertible to 'Bull'  

WF_SENSORTYPE_BIKE_SPEED | WF_SENSORTYPE_BIKE_CADENCE // WFSensorType_t

The hard part I think passes for sensorType another WAV API object that accepts a WFSensorType_t Need to be done, so can not wrap the enum in something else otherwise it will not be able to pass it back to the existing API.

Any ideas? You can try:

itemprop = "text">

You can try:

  go sensorType = WF_SENSORTYPE_HEARTRATE Value | WF_SENSORTYPE_BIKE_SPEED.value | WF_SENSORTYPE_BIKE_CADENCE.value  

However the type of code as sensorType must be guessed by swift UInt8 . You can not declare it as WFSensorType_t


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -