Swift 3 Type 'Any' has no subscript members

后端 未结 1 2098
情歌与酒
情歌与酒 2021-02-15 09:53

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

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

but now I get th

相关标签:
1条回答
  • 2021-02-15 10:23
    let type = (self.data[indexPath.row] as? [String : String])?["Type"]
    

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

    0 讨论(0)
提交回复
热议问题