ios – Expression implicitly coerced from UIView? to Any – How to find line in source code

ios – Expression implicitly coerced from UIView? to Any – How to find line in source code

I managed to clean them all up by process of elimination. I commented out the code a block at a time until a warning disappeared, then inspected that block. It turns out that the culprits were dictionary declarations with mixed data types. I added as [String : Any] to the end of each, and it compiles clean now.

For example:

let params = [
    myInt    : 50,
    myString : some stuff,
    myBool   : true
]

needs to be changed to:

let params = [
    myInt    : 50,
    myString : some stuff,
    myBool   : true
] as [String : Any]

ios – Expression implicitly coerced from UIView? to Any – How to find line in source code

Leave a Reply

Your email address will not be published. Required fields are marked *