user979331 user979331 - 1 year ago 93
Swift Question

Swift 3 Type 'Any' has no subscript members

I just converted my project to Swift 3 I have this line of code here:

let type =[indexPath.row]["Type"] as? String

but now I get this error:

Type 'Any' has no subscript members

Why am I getting this error and do I fix it?

Answer Source
let type = ([indexPath.row] as? [String : String])?["Type"]

You need to cast[indexPath.row] to a dictionary.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download