Search code examples
xlform

How to apply an NSPredicate to a custom XLForm row?


I have a row of type XLFormRowDescriptionTypeSelectorPush

I set row.value to a custom class Agreement and row.addValidator(AgreementValidator())

I want another to be hidden/shown depending upon the value of Agreement.agree (which is "Accepted" or "Declined").

I can't figure out how to do this. Here's where I am so far:

other_row.hidden = NSPredicate(format:"$other_tag.value != "Accepted")

But the value of the other_tag row is Agreement and not a string. How can I compare with Agreement.agree?


Solution

  • Try this.

    other_row.hidden = NSPredicate(format: "NOT $other_tag.value.agree != 'Accepted'")