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!!!
For some reason I'm having a problem with the outerIndex and innerIndex declarations. Error "Ambiguous type name 'Index' in 'Array'"..
Apparently there was a typealias keyword used before, however I still getting the same error message..
typealias Indexx = Int?
var outIndex: Array.Indexx? = nil
However I still getting the same error message...
"Ambiguous type name 'index' in Array'"
Any feedback please??
Christian A. Castro
30,501 PointsBrandon Mahoney Mutating the Data Source | Introduction to Table Views!!
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()
}
}
If this helped you out please remember to up vote and mark as best answer.
Brandon Mahoney
iOS Development with Swift Techdegree Graduate 30,149 PointsBrandon Mahoney
iOS Development with Swift Techdegree Graduate 30,149 PointsWhat video or exercise is this from, link?