Questions tagged [nsorderedset]

NSOrderedSet declares the programmatic interface for static sets of distinct objects.

Part of the iOS Foundation framework.

NSOrderedSet declares the programmatic interface for static sets of distinct objects. You establish a static set’s entries when it’s created, and thereafter the entries can’t be modified. NSMutableOrderedSet, on the other hand, declares a programmatic interface for dynamic sets of distinct objects. A dynamic—or mutable—set allows the addition and deletion of entries at any time, automatically allocating memory as needed.

71 questions
51
votes
1 answer

Why doesn't NSOrderedSet inherit from NSSet?

Surely an ordered set is a more-specific case of a set, so why does NSOrderedSet inherit from NSObject rather than NSSet?
jhabbott
  • 18,461
  • 9
  • 58
  • 95
49
votes
2 answers

Objective-C literals for NSSet and NSOrderedSet?

What, if any, NSSet and NSOrderedSet operations can one perform with the new Objective-C collection literals? For NSArray, NSDictionary, and NSNumber, see here. FWIW, this Big Nerd Ranch Post says the indexing syntax is supposed to work for…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
21
votes
3 answers

Array from set: why does NSSet use allObjects, while NSOrderedSet uses array?

In Foundation, if I want to convert a set to an NSArray, I can use: -[NSSet allObjects] -[NSOrderedSet array] Why are these different?
user4951
  • 32,206
  • 53
  • 172
  • 282
20
votes
3 answers

Iterating over an NSOrderedSet

I'm trying to iterate over an instance of NSOrderedSet. Something like this: func myFunc() { var orderedSet = NSOrderedSet(array: [ 42, 43, 44]) for n in orderedSet { NSLog("%i", n) } } ...however the for loop line produces…
Andrew Ebling
  • 10,175
  • 10
  • 58
  • 75
17
votes
2 answers

CoreFoundation Trap error "Thread1:EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)"

i need your help i've got this frustrating "random" error. The app is compose of one Mapviewcontroller and a collectionview on the second controller. Sometimes when I return to the map from the second controller the app suddenly crash with this…
Dodgson86
  • 333
  • 1
  • 4
  • 15
16
votes
1 answer

How to set an ordered relationship with NSPersistentCloudKitContainer?

When I checked Used with CloudKit, the error Folder.children must not be ordered appeared. Any idea about an ordered relationship? Using Xcode 11 (beta 3). Here's the Folder Entity:
hstdt
  • 5,652
  • 2
  • 34
  • 34
14
votes
2 answers

Swift: CoreData and generic NSOrderedSet

I'm not sure if I just did not found any information or if it's not possible. I've looked up several pages. I want to use generic a generic version of the NSOrderedSet in Swift. With a Set you can do this: Swift’s Set type is bridged to…
user1199624
14
votes
4 answers

How to add element to NSOrderedSet for Core Data?

I did some studies on this post. But none of its solution work for me. Let me explain what I did: It's actually very similar with the mentioned post. Category.h @class Category, Item; @interface Category : NSManagedObject @property (nonatomic,…
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
13
votes
2 answers

How to covert NSMutableOrderedSet to generic array?

I have this for loop, p is a NSManagedObject, fathers is a to-many relationship, so I need to cast NSMutableOrderedSet to [Family] but it does not work, why? for f in p.fathers as [Family] { }
János
  • 32,867
  • 38
  • 193
  • 353
13
votes
1 answer

NSMutableOrderedSet to NSMutableArray

array = [NSMutableArray arrayWithArray:[set allObjects]]; This worked with an NSSet, but how do I get it to work with an NSMutableOrderedSet?
10
votes
3 answers

Core Data ordering with a UITableView and NSOrderedSet

What are the steps that I need to perform to implement user-defined ordering in a UITableViewController with Core Data as the backing store? Do I still need to respond to -tableView:moveRowAtIndexPath:fromIndexPath:toIndexPath: or is the model…
nevan king
  • 112,709
  • 45
  • 203
  • 241
8
votes
2 answers

Coredata and NSOrderedSet - how is the order of the set defined?

I had a look through the existing documentation and couldn't find anything that confirms the behaviour I am seeing. Starting on iOS 5, CoreData relationships can be ordered and in this case the returned object is a NSOrderedSet. Can anyone confirm…
Rog
  • 18,602
  • 6
  • 76
  • 97
8
votes
2 answers

Swift 2.0 one-to-many relationship - still NSOrderedSet?

In Swift 2.0, are one-to-many relationships in Core Data still NSOrderedSets? I cannot seem to be able to cast/downcast appropriately to ever not throw errors. Does anyone have a simple example of this in Swift 2.0?
Kent
  • 1,705
  • 3
  • 16
  • 26
6
votes
1 answer

Retrieving NSOrderedSet from Core Data and casting it to entity managedObjectSubclasss

Im making a Fitness app to learn Core data, and I have found that I need to let the user store every performed workout as a WorkoutLog item, and in there, there should be a series of ExerciseLogs which represents performances of that exercise (it…
Lord Fresh
  • 636
  • 8
  • 15
6
votes
2 answers

How to sort the results of an NSFetchedResultsController using the order of an NSOrderedSet

NSOrderedSets save the order of the objects in the table. If you access an NSManagedObject subclass instance with a property that is an NSOrderedSet, then they will be in order. However, there is seemingly no way to access that order using an…
Corey Floyd
  • 25,929
  • 31
  • 126
  • 154
1
2 3 4 5