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
1
vote
1 answer

Can't clear/reset NSMutableSet?

This is what I'm trying to do. Get 7 random, non-repeating numbers each time my viewDidLoad starts. I got it to create the randoms, but I've been trying to clear the NSMutableSet when it loads to get a fresh set and I'm having trouble. The NSLog…
1
vote
1 answer

Can't observe NSMutableSet additions with ReactiveCocoa

I've got a simple view controller with an NSMutableSet property called selectedEmails. In viewDidLoad I create the empty set and subscribe to changes: self.selectedEmails = [NSMutableSet set]; [RACObserve(self, selectedEmails) subscribeNext:^(id…
pr1001
  • 21,727
  • 17
  • 79
  • 125
1
vote
1 answer

Are predicates the most efficient way to lookup an object in NSSet?

Reading up the documentation about NSSet it says: You can use sets as an alternative to arrays when the order of elements isn’t important and performance in testing whether an object is contained in the set is a consideration. Thats exactly…
Houman
  • 64,245
  • 87
  • 278
  • 460
1
vote
3 answers

NSMutableSet intput is not in the same order as output

I have added objects into a NSMutableSet with this code: _theQuestionsSet = [[NSMutableSet alloc]initWithObjects:@802, @229, @522, @712, @628, @84, @412, @726, @284, @699, @1765, @1754, @1528, @2230, @2005, @1494, @1348, @2132, @2040, @2183,…
PeterK
  • 4,243
  • 4
  • 44
  • 74
1
vote
2 answers

NSMutableSet union set performance/implementation

I'm wondering how is union set implemented in an NSMutableSet instance. I have two large sets that needs to be unionized frequently and I'm wondering if I should implement my own way of unionizing two sets or if Apple's way is fast enough.
ninjaneer
  • 6,951
  • 8
  • 60
  • 104
1
vote
2 answers

Why does NSOrderedMutableSet add objects whose data is the same?

I'm creating objects and adding them to a set using -[NSOrderedMutableSet addObject:], but I discovered that only duplicates of the objects themselves are checked for -- the object pointer's address presumably, and that it's possible to add multiple…
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
0
votes
2 answers

Can not add more than 3 objects to a NSMutableSet

Made a custom obj called Item with some string fields and one float. .h @interface Item : NSObject { NSString * name; NSString * artNum; NSString * collection; NSString * description; …
Stan
  • 6,511
  • 8
  • 55
  • 87
0
votes
1 answer

Leak when carrying out operations on annotations in an MKMapView

I've got a method that takes in the annotations (custom PostLocationAnnotation class) to be displayed on a map view and clusters close ones together, outputting an array of MKAnnotation of PostLocationAnnotations and LocationGroupAnnotations (the…
benwad
  • 6,414
  • 10
  • 59
  • 93
0
votes
1 answer

NSMutableSet count = 1, but that object is null?

Am using an NSMutableSet that is working great, up until this weird SIGABRT error popped up: 2011-07-05 17:01:00.249 Dama[1497:cd57] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet removeObject:]:…
Mazyod
  • 22,319
  • 10
  • 92
  • 157
0
votes
1 answer

Referencing / Accessing a MutableSets-Items-name in a class with different variables(Strings and Sets) in a textbased game of a total Kotlin noob

I am a total noob when its about Kotlin, but I think it is fun to use and in my free time, I am trying to learn it. I got some books and went through them and based on that, to get more practical experiences, I am trying to create a little…
0
votes
0 answers

Why does containsObject not work on an NSSet copy of NSMutableSet?

I’m having an issue when creating a set copy of a mutable set, and then having containsObject fail for the (new) set copy. For example: NSString *sameID = @"XYZ"; Then on main thread/sometimes on different thread: [mutableSet…
bbucca
  • 1
  • 2
0
votes
2 answers

Creating an Array from NSObject Class

I have an NSObject class call Details that holds 3 properties. @interface Details : NSObject @property (nonatomic, nonnull, strong) UIImage *image; @property (nonatomic, assign) NSInteger number; @property (nonatomic, nonnull, strong) NSString…
dicle
  • 1,122
  • 1
  • 12
  • 40
0
votes
1 answer

Store NSMutableSet to NSUserDefaults

I want to store a Swift Set in NSUserDefaults. Given that I can read a NSMutableSet value from UserDefaults using: UserDefaults.standard.mutableSetValue(forKey:) ... it seems like I should be able to write a NSMutableSet too. I tried converting my…
Senseful
  • 86,719
  • 67
  • 308
  • 465
0
votes
1 answer

How to remove applied filter on a NSMutableSet

I have two entities Student and Subjects. Student can have multiple subjects. I am getting NSMutableSet object from Student (NSManagedObject) let studentSubjects = student?.mutableSetValue(forKey: "subjects") Now I want to check if a subject is…
Rajat Jain
  • 1,002
  • 1
  • 15
  • 24
0
votes
0 answers

Equality of custom object in NSMutableSet

I'm having some difficulties adding custom equality checks to one of my own objects. I have a custom Message object which has a unique messageID property which is an NSString, as well as other information about the message. The objects are being…
Matthew Hallatt
  • 1,310
  • 12
  • 24