RyJ RyJ - 11 days ago 16
iOS Question

Swift 3: Expression implicitly coerced from 'UIView?' to Any

Someone else must have received this message while (or after) converting an iOS project to Swift 3, yet when I do a Google search, I get no relevant results.

Anyway, after converting to Swift 3, I have about 30 warnings that say:

Expression implicitly coerced from 'UIView?' to Any


But the warnings do not point to any specific line of code, they only reference the class where the warning exists. Does anyone have an insight into this warning or how I might go about silencing them?

Answer

In my case it was an issue related to a dictionary without explicit type:

let dict = ["key": value]

Than I solved specifying the type:

let dict: [String: Any] = ["key": value]
Comments