Abusing NSPredicate
One of the best things about
NSPredicate
is its parsing engine. Given a well-formattedNSString
,NSPredicate
will turn it into a tree ofNSCompoundPredicate
andNSComparisonPredicate
objects. This can be used to our advantage. If we have a string that represent some boolean expression, we can tapNSPredicate
to parse it for us and give us back an organized syntax tree.