ewan ewan - 2 months ago 30
JSON Question

NSFastEnumerationIteration.member Swift 3

I have some difficult to convert my Swift 2.2 app to Swift 3.0.
I have some errors and I don't find the solution yet. Currently, my worst problem is with

NSFastEnumerationIteration
, I try to get records from JSON but with this error I can't. This is the screenshot of my code with the problem :

Swift 3.0 error with NSFastEnumerationInteration

Answer

In Swift 3 you need to specify the type of object,so specify the type of your data Array to [[String:Any]].

if let dataArr = data as? [[String: Any]] {
    for dd in dataArr {
        //your code for accessing dd.
    }
}