Skip to content

insert(rowFormer:below:) on SectionFormer inserts wrong rowformer #104

@goranche

Description

@goranche

Describe the bug
I'm trying to add a new row to a section in my setup code, and noticed the row not showing up, although a cell was obviously present.
Coding with tagged version 1.8.0

To Reproduce
Steps to reproduce the behavior:

  1. enter code:
let section = SectionFormer(rowFormers: [someRow])
section.insert(rowFormer: someOtherRow, below: someRow)
former.add(sectionFormers: [section])
  1. Run the code

Expected behavior
2 shown rows, one someRow and one someOtherRow

Desktop (please complete the following information):

  • OS: macOS Catalina

Smartphone (please complete the following information):

  • Device: Simulator
  • OS: iOS 13.*

Additional context
In file SectionFormer.swift, line 98 the rowFormer from the enumeration is inserted into the existing array, not the passed argument.

Rather worryingly, in line 102 of the same file, rowFormers is added, but since it's not a passed variable, the private var is taken, effectively duplicating it's content.

Similar issues (not tested) can be observed in line 111, where the enumerated row is added instead of the passed array of rows.
Elsewhere in the same file the same issue can be found in multiple places, not going to list them all here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions