Hi, I think I'm stumbling with my objective-c knowledge causing me some problems. I solved it already but I would like to know why it went wrong
In my original code I did not have the line
. After a lot of cursing I found out that the galleryItems in the array weren't replaced with the new values. Is this because of swift? I seem to remember that in objective-c the elements were pointers hence the last line wasn't needed?
Code:
func deleteGalleryItem(galleryItem: GalleryItem) {
self.galleryItemsArray.removeAtIndex(galleryItem.indexInTheArray)
for index in galleryItem.indexInTheArray..<self.count() {
var item = self.itemAtIndex(index)! asGalleryItem
item.indexInTheArray = index
self.galleryItemsArray[index] = item
}
}
In my original code I did not have the line
Code:
self.galleryItemsArray[index] = item