diff --git a/CHANGELOG.md b/CHANGELOG.md index c07e6420..ff27926a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +## [2.6.2](https://github.com/DenHeadless/DTModelStorage/releases/tag/2.6.2) + +### Fixed + +* `CoreDataStorage` now properly updates new indexPath after Move event on iOS 9. + ## [2.6.1](https://github.com/DenHeadless/DTModelStorage/releases/tag/2.6.1) ### Fixed diff --git a/DTModelStorage.podspec b/DTModelStorage.podspec index 8607b67e..0e421072 100644 --- a/DTModelStorage.podspec +++ b/DTModelStorage.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DTModelStorage' - s.version = '2.6.1' + s.version = '2.6.2' s.license = 'MIT' s.summary = 'Storage classes for datasource based controls.' s.homepage = 'https://github.com/DenHeadless/DTModelStorage' diff --git a/Source/Core/CoreDataStorage.swift b/Source/Core/CoreDataStorage.swift index 81139bc0..0a1521fc 100644 --- a/Source/Core/CoreDataStorage.swift +++ b/Source/Core/CoreDataStorage.swift @@ -116,7 +116,8 @@ public class CoreDataStorage : BaseStorage, StorageProtocol, SupplementaryStorag case .Move: if indexPath != nil && newIndexPath != nil { if indexPath != newIndexPath { - self.currentUpdate?.movedRowIndexPaths.append([indexPath!,newIndexPath!]) + self.currentUpdate?.deletedRowIndexPaths.insert(indexPath!) + self.currentUpdate?.insertedRowIndexPaths.insert(newIndexPath!) } else { self.currentUpdate?.updatedRowIndexPaths.insert(indexPath!) diff --git a/Tests/Specs/CoreDataStorageTestCase.swift b/Tests/Specs/CoreDataStorageTestCase.swift index ecf117dd..c378f87c 100644 --- a/Tests/Specs/CoreDataStorageTestCase.swift +++ b/Tests/Specs/CoreDataStorageTestCase.swift @@ -63,9 +63,8 @@ class CoreDataStorageTestCase: XCTestCase { item1.value = 3 let _ = try? item1.managedObjectContext?.save() - let expectedMovement = [[indexPath(0, 0),indexPath(1, 0)]] - - expect(self.updateObserver.update?.movedRowIndexPaths).toEventually(equal(expectedMovement)) + expect(self.updateObserver.update?.insertedRowIndexPaths).toEventually(equal(Set([indexPath(1, 0)]))) + expect(self.updateObserver.update?.deletedRowIndexPaths).toEventually(equal(Set([indexPath(0, 0)]))) } func testUpdatingValues()