I want to create a view that contain a section with list of options and another row with a "go next button"
But the example code in the GitHub of Eureka does not tell you how to do it. Thats because the example is a empty page with just the checkbox rows and nothing else. When a try to put a button in another section of that view I get the following error:
+++ is not a prefix unary operator
My example class is:
import UIKit
import Eureka
class PaymentView: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
setForm()
}
func onNext() {
print("go to review!")
}
func setForm() {
form
+++ SelectableSection<ListCheckRow<String>>("Elige la forma de pago:", selectionType: .singleSelection(enableDeselection: true))
let paymentMethods = ["Dinero en efectivo", "Datafast"]
for option in paymentMethods {
(self.form.last!) <<< ListCheckRow<String>(option){ listRow in
listRow.title = option
listRow.selectableValue = option
listRow.value = nil
}
}
+++ Section("Footer")
<<< ButtonRow(){
$0.title = "Elegir método de pago"
}
.onCellSelection { [weak self] (cell, row) in
if row.section?.form?.validate().count == 0{
self?.onNext()
}
else {
print("The form has errors")
}
// End form
}
}
}
In case somebody else has the same problem. The solution is this: Before appending a new section or table row item use (self.form) to continue the chain of the the Eureka form generator. It looks like this:
(self.form) +++ Section("button")
// rest of your code