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?

1

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.