I upgraded my project to Swift 3 and came across this error:
let cellDescriptor = cellDescriptors[(indexPath as NSIndexPath).section][indexOfVisibleRow] as! [String: AnyObject]
I got an error on this line:
Type 'Any' has no subscript members
How exactly do I fix this? I'm not sure how to go about it. I tried converted the first part to an NSDictionary, then it tells me that indexPath
of type IndexPath
cannot be converted to NSIndexPath
.
NSIndexPath has been replaced with IndexPath, so that part should become simply
cellDescriptors[indexPath.section]
For the rest of the problem, how have you defined cellDescriptors? It may be easier to do this as a two-step process
let firstPart = cellDescriptors[indexPath.section] as! MyCellDescriptor
let cellDescriptor = firstPart[indexOfVisibleRow]