Eureka: Ambiguous reference to member 'rowByTag' only on certain rows

Created on 15 Apr 2016  路  3Comments  路  Source: xmartlabs/Eureka

Eureka - 1.5.0,
Xcode -7.3
iOS version - 9.3.1

I have created a form with 3 rows.

import UIKit
import Eureka

class CreateEventViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupForm()
    }

    private func setupForm() {
        form
            +++ Section()
            <<< TimeInlineRow("StartingDateTime") {
                $0.title = "Starting"
                $0.value = NSDate()
            }
            <<< TimeInlineRow("EndingDateTime") {
                $0.title = "Ending"
                $0.value = NSDate()
            }
            <<< AlertRow<Calendar>("Calendar") {
                $0.title = "Calendar"
                $0.options = self.calendars
                $0.value = self.calendars.first
            }
    }

    @IBAction func saveButtonTapped(sender: UIBarButtonItem) {
        let startingDateTime = (form.rowByTag("StartingDateTime") as! TimeInlineRow).value!
        let endingDateTime = (form.rowByTag("EndingDateTime") as! TimeInlineRow).value!
        let calendar = (form.rowByTag("Calendar") as! AlertRow).value! //  Ambiguous reference to member 'rowByTag'
    }

}

First two rows are of type TimeInlineRow and the last one is a custom type called Calendar. I have it conformed to Equatable protocol as well.

My issue is I'm getting the error Ambiguous reference to member 'rowByTag' for only the AlertRow. But this error doesn't occur for the two TimeInlineRows.

I found the same error in another issue but the given solution didn't work for me.

It's not the custom type either. I changed it to accept strings but I still get this error. Is this a bug in the library or am I doing something wrong?

rowByTag question

Most helpful comment

@Isuru-Nanayakkara You have to cast it as AlertRow<Calendar> like this:

let calendar = (form.rowByTag("Calendar") as! AlertRow<Calendar>).value!

All 3 comments

@Isuru-Nanayakkara You have to cast it as AlertRow<Calendar> like this:

let calendar = (form.rowByTag("Calendar") as! AlertRow<Calendar>).value!

Oh I see. That works. Thank you.

Just for reference, for Swift 3+, you will need to type:

let calendar = (form.rowBy(tag: "Calendar") as! AlertRow<Calendar>).value!

Was this page helpful?
0 / 5 - 0 ratings