Gold challenge - key for the circles dictionary?


#1

Since the touches parameter in touchesMoved, touchesEnded, and touchesCancelled is of type NSSet *, I presume we can’t really count on the order of the touches to always be the same? Or is that guaranteed by some other part of the framework? I ask, because I’m wondering what the best key for a “circlesInProgress” dictionary would be, since we need two UITouch instances for the circle? If we could count on the order of the touches to be the same, then we can just use the first touch instance to get an NSValue.

I see some of the other Gold challenge solutions here just making a key out of the first UITouch instance, but I wonder if that might not always work?

While two different NSSet* instances with the same two UITouch instances are equal, they do produce different NSValues (using the + valueWithNonRetainedObject) method.


#2

I didn’t use a dictionary for circles. I only create circles from two touches, and use BNRLine object to represent them.