Re: Remove/Disable NSPredicate from NSMutableSet?
Re: Remove/Disable NSPredicate from NSMutableSet?
- Subject: Re: Remove/Disable NSPredicate from NSMutableSet?
- From: Graham Cox <email@hidden>
- Date: Wed, 24 Mar 2010 10:26:01 +1100
On 24/03/2010, at 7:27 AM, Robert Monaghan wrote:
> How does one remove a NSPredicate from an NSMutableSet?
> I want to reuse the NSMutableSet for another purpose, but I have to strip out the Predicate that I assigned.
> Passing "filterUsingPredicate:nil" causes an exception. Is there a way to do this? Or should I generate another NSMutableSet?
I think you're labouring under a misapprehension.
NSMutableSet doesn't 'have a' predicate. You can apply a predicate to a set (mutable or not) to return a new set whose members match the predicate. Once done, the set is a set - it has no memory of the predicate that was used to create it, nor the original unfiltered set.
So you can re-use the set if you want, but it's usually cleaner and easier just to create a new set for a new purpose.
--Graham
_______________________________________________
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