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 trialChristian A. Castro
30,501 PointsAmbiguous type name 'Index' in 'Array' PLEASE HELP!!! Mutating the Data Source | Introduction to Table Views
For some reason I'm having a problem with the outerIndex and innerIndex declarations. Error "Ambiguous type name 'Index' in 'Array'"..
I have been looking around, but apparently there's no answer or good explanation for it.
Apparently there was a typealias keyword used before, however I still getting the same error message..
var outIndex: Array.Index? = nil
However I still getting the same error message... "Ambiguous type name 'index' in Array'"
1 Answer
Brandon Mahoney
iOS Development with Swift Techdegree Graduate 30,149 PointsIt appears this is mostly abstracted away now. You just need to get the index path then the object itself and update from there.
extension ContactListController: ContactDetailControllerDelegate {
func didMarkAsFavoriteContact(_ contact: Contact) {
guard let indexPath = dataSource.indexPath(for: contact) else {
return
}
var favoriteContact = dataSource.object(at: indexPath)
favoriteContact.isFavorite = true
dataSource.updateContact(favoriteContact, at: indexPath)
tableView.reloadData()
}
}
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHi Christian,
I could do with a link to the course you're doing but have you tried
.index
rather than.Index
? i.e. no capitalisation.Steve.