Search code examples
swiftxcodeeureka-forms

Swift Eureka ActionSheetRow options based on the value of another row


I am attempting to have an ActionSheetRow, but I would like the options of this row to be based on the value selected on a different ActionSheetRow. I attempted on placing and if statement before the dependent ActionSheetRow but this did not work. I also attempted to add an if statement before setting the options and this also did not work. Is this something that is possible and if so how would I go about doing this?

Thank you all feed back welcome


Solution

  • In your setup closure of the ActionSheetRow you get the row you want to switch on, see:

    let row: RowOf<String>! = form.rowBy(tag: "Request")
    let value = row.value ?? ""
    
    if value == "1" {
      $0.options = ["A", "B"]
    } else {
      $0.options = ["C", "D"]
    }
    

    That should work.