xmartlabs/XLForm

Predicates not functional

Opened this issue · 3 comments

Sometimes I get a crash, sometimes it just doesn't do what it's meant to....

sample from my code.

NSString *const kXX = @"xx";

XLFormRowDescriptor *x = [XLFormRowDescriptor formRowDescriptorWithTag:kXX rowType:XLFormRowDescriptorTypeBooleanSwitch title:@"Test Predicate"];
x.value = @0;
[section addFormRow:x];

section = [XLFormSectionDescriptor formSection];
section.hidden = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"$%@ == 0", kXX]];
[form addFormSection:section];

It seems that the dictionary supplied for hidden and disabled predicates isn't in the appropriate format, I've added an iteration to fix it (not ideal), a cache of the correct data would be a better option.

This fixes it, but not entirely, there also seems to be an issue with predicates not being evaluated in rows inside of sections which are governed by predicates. I'll fix that issue in a separate PR.

The rows in sections thing wasn't a real issue.