Karthikeyan Bose
Karthikeyan Bose

Reputation: 1274

Type 'NSFastEnumerationIterator.Element' (aka 'Any') has no subscript members

I've found an exact solution for above error here http://stackoverflow.com/q/39429342/5309431 and I try to execute that in my code. But the issue is not solved. I don't know what I've made wrong. Please Help

for dict in self.levelRefArr{
  if let datas = dict["data"] as? [[String:Any]] { //Type 'NSFastEnumerationIterator.Element' (aka 'Any') has no subscript members
      print(datas)
   }                   
 }

Upvotes: 2

Views: 1553

Answers (1)

vadian
vadian

Reputation: 285072

levelrpfarr is most likely Any, you need to cast it to the actual type which tells the compiler the type of the items in the array

for dict in self.levelRefArr as! [[String:Any]] { ...

Upvotes: 2

Related Questions