VAAA VAAA - 1 year ago 310
Swift Question

Eureka - how to pass values to elements in custom row

I my swift projects using Eureka forms and I have a customer row:

This is my Xib:

enter image description here

This is my class:

public class CustomServiceCell : Cell<Bool>, CellType{

@IBOutlet weak var btnDelete: UIButton!
@IBOutlet weak var lblTitle: UILabel!

public override func setup() {
//height = { 60 }
//lblTitle.text = row.title
selectionStyle = .None
//btnDelete.addTarget(self, action: #selector(onDelete), forControlEvents: .TouchUpInside)


@IBAction func onDelete(sender: UIButton) {
print("Delete Button tapped")
row.value = true


public override func update() {


And this is how I add it to my form:

<<< CustomServiceRow();

I would like to know how can I pass values to set the name of the text of my button and the text of my label.

Any clue?

Answer Source

From Eureka's readme in Github:

let row  = SwitchRow("SwitchRow") { row in      // initializer
                        row.title = "The title"
                    }.onChange { row in
                        row.title = (row.value ?? false) ? "The title expands when on" : "The title"
                    }.cellSetup { cell, row in
                        cell.backgroundColor = .lightGrayColor()
                    }.cellUpdate { cell, row in
                        cell.textLabel?.font = .italicSystemFontOfSize(18.0)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download