ra1028 / Former

Former is a fully customizable Swift library for easy creating UITableView based form.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

goranche opened this issue · comments

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.