[Solved] Loop through dictionary error : type (key:Int, value: Any) does not conform to protocol sequence –


Your code should be

var test = [[Int: Any]]()

//assign your header

for tes in test{

    for (key, value) in tes{ // error line
        print("\(key)")
    }
}

So first of all:

  • You must have an array of dictionary and not just a dictionary: [[Int: Any]]
  • Change your last for to for (key, value) in tes

solved Loop through dictionary error : type (key:Int, value: Any) does not conform to protocol sequence –