0

I have a Swift class that contains below enum:

    @objc public enum AlertStyle : Int {
    case Success,Error,Warning,None
    case CustomImag(imageFile:String)
}

I do the bridging and other integration phases for using swift classes in Objective-C, but when I build the app, compiler shows below error:

<unknown>:0: error: cannot assign value of type '(imageFile: String) -> AlertStyle' to type 'AlertStyle'

How can I fix it?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Husein Behboudi Rad
  • 5,434
  • 11
  • 57
  • 115

2 Answers2

0

Unfortunately, you can't use associated values in Objective C.

pbergson
  • 230
  • 3
  • 9
0

Enum with associated values can not be represented in Obj-C. If you don't need your enum to be available from objc-c you can remove @objc declaration. In other case you need to redesign your solution.

salabaha
  • 2,468
  • 1
  • 17
  • 18