appcoda / expandable-table-view

Expandable UITableView in iOS
181 stars 55 forks source link

Ambiguous use of 'subscript' #2

Open safetylab opened 8 years ago

safetylab commented 8 years ago

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?

thihaaung6245 commented 8 years ago

Same Here...Xcode 7.3.1

eleev commented 8 years ago

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