Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous use of 'subscript' #2

Open
safetylab opened this issue Nov 24, 2015 · 2 comments
Open

Ambiguous use of 'subscript' #2

safetylab opened this issue Nov 24, 2015 · 2 comments

Comments

@safetylab
Copy link

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
Copy link

thihaaung6245 commented May 25, 2016

Same Here...Xcode 7.3.1

@eleev
Copy link

eleev commented Sep 15, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants