Swift 2.1 deliveryOptions.pushPolicy = PUSH_ONLY error: cannot assign value PushPolicyEnum to String

I am trying to send a push only message.
I need to assign the delivery options, but it seems that the push policy enum is not correctly correlated to a String that swift can use.
I have tried .rawValue but that gives an Int and not a String so still with error.
Please advise :slight_smile:

Can you show how you’re doing it in the code?

It’s pretty straight forward:

 let deliveryOptions = DeliveryOptions()

deliveryOptions.pushSinglecast = [pushDeviceId]

  // deliveryOptions.pushPolicy = PUSH_ONLY //ERROR HERE - see attached

Hi Bilal,

To set deliveryOptions,pushPolicy you should use the method, not a property of NSString type:
deliveryOptions.pushPolicy(PUSH_ONLY)

Regards,
Slava

Ok perfect, that worked… ! You should make the property read-only (only getter no setter) for swift.

Thanks!