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

前端 未结 4 979
既然无缘
既然无缘 2020-12-05 03:47

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,

4条回答
  •  北海茫月
    2020-12-05 04:40

    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]
    

    In your case you can specify your value type:

    let dict: [String: UIView] = ["key": value]
    

提交回复
热议问题