iOS Cocoa pod Eureka: How to add an CheckRow list and a button

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



iOS Cocoa pod Eureka: How to add an CheckRow list and a button



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






1 Answer
1



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






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.