Eureka: Use of unresolved identifier 'form'

Created on 20 May 2018  路  1Comment  路  Source: xmartlabs/Eureka

So I am unable to build my test application with Eureka.

I am using Eureka 4.1.0
xcode 9.3.1
iOS 10.13.4 on a Macbook Pro

This is the podfile:

platform :ios, '10.0'

target 'Test Eureka' do

use_frameworks!

pod 'Eureka', :git => 'https://github.com/xmartlabs/Eureka.git', :tag => '4.1.0'

Here is my code in ViewController.swift

import UIKit
import Eureka

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    form +++ Section("Section1")   <<== Where the error in the title occurs
        <<< TextRow(){ row in
            row.title = "Text Row"
            row.placeholder = "Enter text here"
    }

}

What am I doing wrong?

Most helpful comment

You need to use the FormViewController class in place of UIViewController. That should solve your issue. I think this type of questions is requested to be over at stackoverflow.com, a great resource.

the code below is direct from the README

https://github.com/xmartlabs/Eureka#how-to-create-a-form

    import Eureka

    class MyFormViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        form +++ Section("Section1")
            <<< TextRow(){ row in
                row.title = "Text Row"
                row.placeholder = "Enter text here"
            }
            <<< PhoneRow(){
                $0.title = "Phone Row"
                $0.placeholder = "And numbers here"
            }
        +++ Section("Section2")
            <<< DateRow(){
                $0.title = "Date Row"
                $0.value = Date(timeIntervalSinceReferenceDate: 0)
            }
    }
}

>All comments

You need to use the FormViewController class in place of UIViewController. That should solve your issue. I think this type of questions is requested to be over at stackoverflow.com, a great resource.

the code below is direct from the README

https://github.com/xmartlabs/Eureka#how-to-create-a-form

    import Eureka

    class MyFormViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        form +++ Section("Section1")
            <<< TextRow(){ row in
                row.title = "Text Row"
                row.placeholder = "Enter text here"
            }
            <<< PhoneRow(){
                $0.title = "Phone Row"
                $0.placeholder = "And numbers here"
            }
        +++ Section("Section2")
            <<< DateRow(){
                $0.title = "Date Row"
                $0.value = Date(timeIntervalSinceReferenceDate: 0)
            }
    }
}
Was this page helpful?
0 / 5 - 0 ratings