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
2
votes
1 answer

Populating TableView with NSMutableSet

I am using core data and trying to populate a UITableView with an NSMutableSet. I have two entities, Teams and Players. On my addTeamsController I am saving a player to the team as follows -(void)saveButtonWasPressed { self.team…
Luke
  • 612
  • 1
  • 6
  • 19
2
votes
3 answers

How to set object count to zero(or some value) in NSCountedSet?

I have following NSCountedSet (item1 [2000], item2 [9000], item3 [200], item4 [3000]) Now i want to remove item1 object from my set. one solution is while([mySet countForObject:item1]) [mySet…
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
1
vote
2 answers

NSMutableSet Not adding object

My code isn't adding elements to my sets. My header file is as follows: #import @interface NHPSearchViewController : UITableViewController //For using the local DB @property (strong, nonatomic) NSManagedObjectContext…
user597608
  • 387
  • 8
  • 20
1
vote
1 answer

NSMutableDictionary most efficient way to apply formula for each value

I have a NSMutableDictionary with NSNumbers. When I finish building the set I need to recalculate all the values using the currently stored value itself. Now I'm using fast enumeration and storing into a new NSMutableSet, but I'm not experienced in…
Miguel E
  • 1,316
  • 2
  • 17
  • 39
1
vote
1 answer

adding objects in a container inside other object is null with arc

I am using Apple's ARC. I have tow classes: one that has a NSMutableSet and one that I want to put inside that NSMutableSet. So when I do the following: ContainerClass* contClass = [[ContainerClass alloc] init]; for(int i = 0;i<10;i++) …
amir
  • 1,332
  • 8
  • 15
1
vote
2 answers

toll-free bridged objects, retain and release

I'm currently looking at a NSMutableSet created by the function CFSetCreateMutable(). The documentation states that the return value of CFSetCreateMutable() is toll-free bridged, meaning that I can simply cast it into a NSMutableSet. Does this mean…
Jörgen Sigvardsson
  • 4,839
  • 3
  • 28
  • 51
1
vote
1 answer

Objective c, reverse Collatz, help me debug NSArrays

I am working on a math fair project using the Collatz conjecture, I am wanting to make a reverse graph as you can find here on wikipeadia although I have found that I have messed up somewhere in my code and it doesn't show all of the reverse values…
coopf
  • 59
  • 5
1
vote
2 answers

Calling methods of NSMutableSet in another function throws EXC_BAD_ACCESS

I'm stuck on such code: static NSMutableSet* test_set; -(void)foo1 { test_set=[NSMutableSet setWithObject:[NSNumber numberWithInt:1]]; NSLog(@"count:%d",[test_set count]); } -(void)foo2 { NSLog(@"pointer:%p",test_set); …
1
vote
1 answer

Detect change in NSMutableOrderedSet with Swift Combine

I'm trying to observe change of an NSMutableOrderedSet in my ViewModel with combine. I want to know when some element is added or removed of NSMutableOrderedSet Some code of my ViewModel : class TrainingAddExerciceViewModel: ObservableObject { …
Jopolaz
  • 402
  • 1
  • 3
  • 18
1
vote
1 answer

In a macOS Objective-C application, I have subclassed NSMutableSet for enforcing an equality different from isEqual. Is my implementation fine?

In my macOS Objective-C application, I have created a subclass of NSMutableSet. What I want to achieve is a NSMutableSet that does not use isEqual: as the comparing strategy. Specifically, The set will contain objects of type NSRunningApplication,…
Alfonso Tesauro
  • 1,730
  • 13
  • 21
1
vote
1 answer

How to perform union set for multiple sets in Objective C

I have an array of NSSet instances as mentioned in below code. NSArray *a = @[@"1", @"2", @"3", @"4", @"5"]; NSArray *b = @[@"1", @"2", @"3", @"6", @"7"]; NSArray *c = @[@"1", @"7", @"8", @"9", @"5"]; NSArray *d = @[@"1", @"6", @"7", @"8", @"9"];…
Jekil Patel
  • 403
  • 4
  • 18
1
vote
1 answer

componentsByString for NSMutableSet in Swift 3.0

I have label and NSMutable Set. I want to assign my set value to label.text. @IBOutlet var location: UILabel! var mutSet:NSMutableSet = NSMutableSet() self.location.text =…
1
vote
1 answer

Drawing a path with MKMapView problems

I'm trying to draw a path (with MKMapView). But I have: NSInvalidArgumentException ', reason:' *** - [NSMutableOrderedSet addObject:]: object can not be nil '. I have this button action with a NSTimer that calls the function stop @IBAction func…
1
vote
1 answer

Why NSMutableSet can be added more objects than capacity

Create one nsmutableset with capacity for example 3, but you can add more than 3 objects into it. So what is the real capacity ? From Apple Docs, seems like this is okay, but what is the purpose of "capacity" ? Return Value A mutable set with…
Forrest
  • 122,703
  • 20
  • 73
  • 107
1
vote
1 answer

Swift: NSMutableSet -> Type 'CGPoint' does not conform to protocol 'AnyObject'

Why does this code results to "Type 'CGPoint' does not conform to protocol 'AnyObject'"? let mutableSet = NSMutableSet() override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { /* Called when a touch begins */ touch =…
user3673836
  • 591
  • 1
  • 9
  • 23