Group Group Group Group Group Group Group Group Group

Chapter 3, converting the relationship to unordered set (NSSet)



The Note on page 78 states that if the walks relationship was unordered one could set the “one” side of the relationship via the following code in the “add” function: = currentDog

I’ve done so (after commenting out the NSMutableOrderedSet and NSOrderedSet lines) and now the following line of code in cellForRowAtIndexPath fails:

let walk = currentDog.walks![indexPath.row] as! Walk

because “Type NSSet has no subscript members”, which makes sense. What would cellForRowAtIndexPath (and any other applicable function) look like in the case of an unordered relationship?


1 Like

Bumping this because I have the same question. From what I have read, it is very rare to need to use NSOrderedSet, so it is strange that they would use that in the example.


Did anyone ever figure out why this happens?


@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]