I am working on an application which works with items distributed in a circular route.
The entry point is random.
So when the whole thing starts I need to shift the set with all the positions to a random index.
Example (with arbitrary data):
0:Hungry -> 1:Eating -> 2:Full -> 3:Vomiting*
If I shift this to the index 2 I get the following new set.
2:Full -> 3:Vomiting -> 0:Hungry -> 1:Eating
So how to achieve this in Objective C?
* Sorry, but I needed another element because three elements didn’t seem to get the point across…
I managed to solve the problem with a category on
NSOrderedSet:This is my Category on
NSOrderedSet: