File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,15 @@ private extension TableViewController {
128128 self . tableView. animate ( animation: customAnimation, completion: nil )
129129
130130 case . indexPaths:
131- let evenIndices = ( 0 ..< self . dataSource. exampleItems. count) . compactMap { return ( $0 % 2 == 0 ) ? IndexPath ( row: $0, section: 0 ) : nil }
131+ let groupedItems = Dictionary ( grouping: ( 0 ..< self . dataSource. exampleItems. count) , by: { $0 % 2 } )
132+
133+ let oddIndices = groupedItems [ 1 ] ? . compactMap { IndexPath ( row: $0, section: 0 ) }
134+ let leftAnimation = TableViewAnimation . Cell. left ( duration: 0.5 )
135+ self . tableView. animate ( animation: leftAnimation, indexPaths: oddIndices, completion: nil )
136+
137+ let evenIndices = groupedItems [ 0 ] ? . compactMap { IndexPath ( row: $0, section: 0 ) }
132138 let rightAnimation = TableViewAnimation . Cell. right ( duration: 0.5 )
133139 self . tableView. animate ( animation: rightAnimation, indexPaths: evenIndices, completion: nil )
134-
135140 }
136141 }
137142
You can’t perform that action at this time.
0 commit comments