Struct Init with JSON and flatMap

纵饮孤独 提交于 2019-12-02 13:33:45
Bista
let listActors = actorsJSON as? [[String : AnyObject]] {

Should be:

if let listActors = actorsJSON as? [[String : AnyObject]] {

Edit: For more info I'd like to add Vadian's comment:

Very confusing code. What does the function in the middle of the do block? Why do you type-check actorsJSON twice? The computed property is let listActors... which should be probably an optional binding (if let ... ). Further .mutableContainers is completely nonsense in Swift. And finally a JSON dictionary is [String:Any] in Swift 3.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!