Questions tagged [nsmutableset]

The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects.

The NSMutableSet class declares the programmatic interface to an object that manages a mutable set of objects. NSMutableSet provides support for the mathematical concept of a set.

NSMutableSet is “toll-free bridged” with its Core Foundation counterpart, CFMutableSetRef.

Resources:

74 questions
0
votes
2 answers

*[NSMutableSet addObject: X]* adds object X even though *[Y isEqual:X]* returns TRUE for an object Y already in the Set

I have a Objective-C class called FactorHelper whose definition is below. It has a property called factors which is an NSMutableArray of NSNumbers. I have a custom isEqual: method in this class that returns true if the factors property in the two…
Smart Home
  • 801
  • 7
  • 26
0
votes
2 answers

How cast a NSSet to NSMutableSet in Swift

I am using Core Data in my app and am dealing with a many to many relationship between two entities. My goal is to have the user select which of one entity will be related to another entity by using a tableview and having the user select cells. When…
Jason Brady
  • 1,560
  • 1
  • 17
  • 40
0
votes
2 answers

Objective-C:Get a Wrong Output and I don't Why when I sort NSMutableSet

I was sorting an nsmutableSet but I met a weird problem. NSArray *data = @[@[@"1",@"2",@"3"], @[@"2",@"3",@"4",@"5",@"6"], @[@"8",@"9",@"10"], @[@"15",@"16",@"17",@"18"]]; NSArray *sortArr…
iceChao
  • 7
  • 5
0
votes
2 answers

Removing Duplicate Custom Objects from two arrays and combining them

First off i have searched a lot but all methods seems to be for primitives or for whole custom objects. My situation is this. I have a type custom objects in two different arrays. However the fields of every single objects is quite different to…
Win Coder
  • 6,628
  • 11
  • 54
  • 81
0
votes
1 answer

isEqualToSet not returning correct value

I am having two NSArray which contains integer values. I want to get common values from both arrays and for this am using NSMutableSet. Here is my code ` NSMutableSet *set1 = [NSMutableSet setWithArray:array1]]; NSMutableSet *set2 =…
0
votes
1 answer

Retaining my newly created NSSet

I have 2 buttons: button1 and button2. I want to create a NSSet each for a correspond button touched and want to display set1 value when button 2 is touched and vice-versa. Only set 1 prints when button1 is pressed and only set2 when button 2 is…
amystic
  • 5
  • 3
0
votes
2 answers

How to disable sorting for - allObjects in NSMutableSet?

In my OSX app I have NSMutableSet that contains custom objects. I implemented -isEqual and -hash methods in my custom object classes, so that the set can do comparison the way I want. However, whenever I insert a new object into my set and then…
Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80
0
votes
0 answers

NSMutableSet removeObject not working as expected

I am working with a NSMutableSet that contains objects that mutable objects. I am finding inconsistencies on NSMutableSet when trying to remove an object that has been mutated. In order to isolate the problem I have coded a quick test to illustrate…
atxe
  • 5,029
  • 2
  • 36
  • 50
0
votes
3 answers

Is -allObjects on NSMutableSet thread safe?

The documentation on NSSet objectEnumeration says: When this method is used with mutable subclasses of NSSet, your code shouldn’t modify the set during enumeration. If you intend to modify the set, use the allObjects method to create a “snapshot”…
reggian
  • 627
  • 7
  • 21
0
votes
2 answers

How to reference objects in NSMutableSets

I have a small C# library that I am trying to port (actually re-writing the C# code using it as a guide) to Obj-C. The purpose of the library is to generate recurring appointments for an iOS calendar app. I'm having problems porting C# structs to…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
0
votes
2 answers

Explanation needed (UITableView, NSMutableSet)

@property (strong,nonatomic)NSMutableSet*selectedRows; @property(nonatomic,retain) IBOutlet UITableView *tableView; ... self.selectedRows = [NSMutableSet new]; ... -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath…
Andrii Tishchenko
  • 1,842
  • 2
  • 13
  • 15
0
votes
2 answers

Objective C - NSMutableSet not working properly

I have an NSMutableSet that I am trying to add labels to. After each label added, I check the set's count and it comes back as 0. Any help will be appreciated In my .h file: @interface MainMenu : CCLayerColor { NSMutableSet* letters; } In my .m…
0
votes
1 answer

Unable to add object to NSMutableSet (error: no visible interface)

I am using XCode 5 and iOS 7 on my iPad app. I am trying to save row indexes that have been selected by the user. In -didSelectRowAtIndexPath, I use this code to mark the rows: // initialize singleton SingletonSelectedCellIndexes…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
0
votes
2 answers

Compare two array and get the common value back in an array

To compare the two array I used NSMutableSet and then intersect the two sets to get the common result in an array. NSMutableSet *set1 = [NSMutableSet setWithArray:array]; [set1 intersectSet:[NSSet setWithObject:[NSNumber…
GameBegins
  • 580
  • 7
  • 12
0
votes
2 answers

Is [NSMutableIndexSet copy] behavior incorrect?

Look at following two statements: NSMutableIndexSet *selectedRows = [[[NSMutableIndexSet alloc] initWithIndexSet:[_dataTableView selectedRowIndexes]] autorelease]; NSMutableIndexSet *rowsToDelete = [[selectedRows copy] autorelease]; I expected…
Nitesh
  • 2,681
  • 4
  • 27
  • 45