You control the removing of x, right ?
- before removing, get the position (
selectionIndexPaths
and its indexPath) of A
- just after removing, and after reload, compute the new indexPath of A (you may compute of search through the cells to find it)
- then set the
selectionIndexPaths to the right value
Does that make sense for you ?
Note
var selectionIndexPaths: Set<IndexPath> { get set }
This property reflects the index paths of the currently selected items, where each index path contains a
section
number and an index number for the
item
in that section. This property is updated automatically when the user selects items interactively.
You can also change the selection programmatically by assigning a new value to this property. To animate changes to the selection, call this method on the collection view’s
animator()
proxy object instead.
It is a programmer error to specify an index path that does not refer to a valid item in the data source. If you specify an invalid index path, this method raises an exception.
This property is key-value observable. Other methods that modify the selection automatically update this property.