Skip to content

Commit

Permalink
Remove superfluous updates from BasicDataSource when moving items (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorfroelich authored Jul 28, 2020
1 parent 0732c15 commit 6a74e0f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/BasicData/BasicDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public class BasicDataSource<Section>: DataSourceType where Section: SectionType
}

public func moveItem(at sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
var sections = self.sections
let item = sections[sourceIndexPath.section].items[sourceIndexPath.item]
sections[sourceIndexPath.section].items.remove(at: sourceIndexPath.item)
sections[destinationIndexPath.section].items.insert(item, at: destinationIndexPath.item)
self.sections = sections
}
}

0 comments on commit 6a74e0f

Please sign in to comment.