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 trialHenry Cooper
iOS Development with Swift Techdegree Student 6,182 PointsAmbiguous 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!
1 Answer
Rafał Małczyński
15,699 PointsHey, 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!
Qasa Lee
18,916 PointsBrilliant!
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
9,964 PointsChristian, 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
Marcus Klausen
17,425 PointsMarcus Klausen
17,425 PointsDid 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 :)