Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Introduction to Table Views Decoupling the Data Source Mutating the Data Source

Henry Cooper
seal-mask
.a{fill-rule:evenodd;}techdegree
Henry Cooper
iOS Development with Swift Techdegree Student 6,182 Points

Ambiguous type name 'Index' in 'Array'

Hi everyone, I seem to be having a problem with the outerIndex and innerIndex declarations. Both are saying giving me the error "Ambiguous type name 'Index' in 'Array'"

This is the second time I've done this project and it didn't happen the first time around but I can't seem to find any mention online. Perhaps something to do with Swift 4/Xcode 9

Thanks!

Did you find the answer? If so you should post it in the answer section, as this page is index on google, and could help other students. I'm currently stuck on this matter too :)

1 Answer

Rafał Małczyński
Rafał Małczyński
15,699 Points

Hey, simply check the docs! https://developer.apple.com/documentation/swift/array/index It seems like 'Array.Index' has been "typealiased" recently - simply 'Int', instead of writing all of that. Hope I helped you!

Christian A. Castro
Christian A. Castro
30,501 Points

@QasaLee Did you was able to figure out?? I still getting the same issue?? My question is how I should implement the code...

typealias Indexx = Int?
var outIndex: Array.Indexx? = nil

However I still getting the same error message... 
"Ambiguous type name 'index' in Array'" 
Trevor Duersch
Trevor Duersch
9,964 Points

Christian, If you read Rafał Małczyński's comment, you simply just change it to "Int?" Check it out -

        var outerIndex: Int? = nil
        var innerIndex: Int? = nil