RyJ RyJ - 1 year ago 293
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 Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download