I have a typical "select a row, slide it up to the top" animation ...
data .. update to the final data
coll.performBatchUpdates({
coll.deleteSections(removeIndexPathSections)
coll.moveSection(indexPathOfTargetRow, toSection: 0)
}) { _ in
completion()
}
So, the rows of the collection
A
B
C
D
E
the user clicks "D" row and we get
D
ie removeIndexPathSections1
would be [0,1,2,4]
and indexPathOfTargetRow
would be 3
This works fine but what happens in detail is
the four rows fade away over the half second
the "D" row slides up to the top position over the same half-second
That's fine but I would prefer
the four rows instantly disappear
the "D" row slides up to the top position over a half-second
I can't find a way to do this. Is it possible?
My workaround is just to run this sort of code first ..
let viz = coll.indexPathsForVisibleItems
for v in viz {
if v.section == 0 { continue }
if v.section == indexPathOfTargetRow { continue }
coll.cellForItem(at: v)?.isHidden = true
// don't fet due to this you have to unhide
// in prepareForReuse every cell type used :/
}
.. then the above code ..
.. which is a shame.
In related approaches,
perhaps there's a way to run the two animations sequentially versus simultaneously?
perhaps you can set the animation time, or, each of the two animations differently?
You can changed the peed with
coll.forFirstBaselineLayout.layer.speed = ..
but I could not find how to independently change the two animations.
Any ideas ?