swiftxcodeeureka-forms

When Eureka PickerInlineRow value is added via cell.detailTextLabel, form.values() shows initial text


TLDR; When I try to print the values out from the form, the text changes to the initial text

When row is tapped on, I programmatically enter in the first item in an array. This populates the value of the cell and I can move on to a different row.

        let fruit = ["Apple", "Peach", "Pear"]
        <<< PickerInlineRow<String>(){
            $0.title = "Fruits"
            $0.options = fruit
            $0.tag = "pickerTag"
            $0.value = "Select your favorite"
        }
        .onExpandInlineRow({ (cell, inlineRow, row) in
            cell.detailTextLabel?.text = fruit[0]
        })

When I click my "Review" button I try to print out the response from the pickerRow and I do not get what is actually in the cell I get a response of the initial text (i.e. Select your favorite)

    <<< ButtonRow("Review") {
       $0.title = "Review"
    }
    .onCellSelection { [weak self] (cell, row) in
        self?.printoutValues()
    }

in printoutValues func

   let values = form.values()
   print("picklerValue: \(values["pickerTag"] as? String)")

If a user actually moves the picker view instead of just tapped on the row and then to the next row then the value is printed correctly.

How can I populate the row when a user first taps on the row and have it save?

thanks


Solution

  • I believe this only stopped working in newer versions of Eureka, but anyways I figured it out.

    In .onExpandInlineRow

    you have to add inlineRow.value = fruit[0]