Skip to content

[0.2.1] Reloading cell while others move around it crashes #3

@tomlokhorst

Description

@tomlokhorst

Example:

let previous: [(String, String)] = [
  ("41", "Alpha 1"),
  ("42", "Beta 1"),
  ("43", "Gamma 1"),
  ("44", "Delta 1"),
]

let new: [(String, String)] = [
  ("40", "Hello!"),
  ("41", "Alpha 2"),
  ("43", "Gamma 2"),
  ("42", "Beta 2"),
  ("44", "Delta 2"),
]

previous.diff(new, identifierSelector: { $0.0 })

Results in this diff:

ElementDiff(deleted: [], inserted: [0], moved: [0: 1, 1: 3, 3: 4], unmoved: [2])

Which causes this crash:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to perform an insert and a move to the same index path (<NSIndexPath: 0xc000000000600016> {length = 2, path = 0 - 3})'

I guess this means we can't blindly reload cells. I'll remove that feature for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions