ios - 'NSFastEnumerator.Element' (aka 'Any') has no subscript members -


i going through appcoda blog , came across function have indices of visible rows. learning , implementing swift 3 / xcode 8. no subscript members error following function.

func getindicesofvisiblerows() {     visiblerowspersection.removeall()      currentsectioncells in celldescriptors {         var visiblerows = [int]()          row in 0...((currentsectioncells as! [[string: anyobject]]).count - 1) {             if currentsectioncells[row]["isvisible"] as! bool == true { //get compile time error here                 visiblerows.append(row)             }         }          visiblerowspersection.append(visiblerows)     } } 

how object of currentsectioncells array object key "isvisible" here?

you need specify type of array celldescriptors [[[string:any]]] way.

for currentsectioncells in celldescriptors.objectenumerator().allobjects as! [[[string:any]]]{     var visiblerows = [int]()      row in 0..<currentsectioncells.count {         if currentsectioncells[row]["isvisible"] as! bool == true {              visiblerows.append(row)         }     }     visiblerowspersection.append(visiblerows) } 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -