expandable-table-view icon indicating copy to clipboard operation
expandable-table-view copied to clipboard

Ambiguous use of 'subscript'

Open safetylab opened this issue 9 years ago • 2 comments

When I try to add your example in my code I have

let cellDescriptor = cellDescriptors[indexPath.section][indexOfVisibleRow] as! [String: AnyObject]

Ambiguous use of 'subscript'

How can I fix this?

safetylab avatar Nov 24 '15 19:11 safetylab

Same Here...Xcode 7.3.1

thihaaung6245 avatar May 25 '16 08:05 thihaaung6245

You can fix this error by splitting the expression and casting each subscript to appropriate type, like this:

 let array = cellDescriptors[indexPath.section] as! NSArray
 let dict = array[indexOfVisibleRows] as! NSDictionary

Here dict is your dictionary of type (String: AnyObject)

Swift is a strongly typed language and that is why you are getting this error

eleev avatar Sep 15 '16 05:09 eleev