Re: Determine keys used in NSPredicate
Re: Determine keys used in NSPredicate
- Subject: Re: Determine keys used in NSPredicate
- From: Trygve Inda <email@hidden>
- Date: Sat, 19 Oct 2013 22:27:39 -0700
- Thread-topic: Determine keys used in NSPredicate
> On Oct 19, 2013, at 10:44 PM, Trygve Inda wrote:
>
>> I have an array of objects. These objects may have some dynamic properties
>> handled with valueForUndefinedKey.
>>
>> If I create a predicate along the lines of:
>>
>> myObject.proertyA = something AND
>> myObject.proertyB = somethingElse AND
>> myObject.dynamicPropertyA = someOtherThing
>>
>>
>> How can I look at myPredicate and determine that it uses dynamicPropertyA?
>>
>> Is it enough and safe to use [myPredicate predicateFormat] and then search
>> the resulting string for dynamicPropertyA?
>>
>> The reason is that my dynamic properties can be removed and I would need to
>> go and find all the NSPredicates that are using a property that is about to
>> go away.
>
> You could but I imagine it would be fragile. You may be better off building
> your predicates manually--NSComparisonPredicate/NSExpression gives you the
> introspection that you need.
My question is: After I have an NSPredicate built by the user with the
Predicate editor, how can determine the keys that the NSPredicate uses?
The user may set it up like:
>> myObject.proertyA = something AND
>> myObject.proertyB = somethingElse AND
>> myObject.dynamicPropertyA = someOtherThing
And then later want to get rid of the someOtherThing property in all the
objects and I need to be able to know if any of the user's NSPredicates make
a reference to someOtherThing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden