Good day,
I'm new to Swift (and object-oriented languages altogether) and I'm creating an iPad app that lets you draw using your finger. I'm currently trying to manage multitouch events correctly, and I'd like to keep track of the touches. The idea is to draw only following one touch, and discard the others, ignoring them even after the initial touch has ended.
For that, I need to identify each touch, but the UITouch object doesn't contain an ID. Actually, since touches are stored in an NSSet, they aren't ordered.
Erring on the internet, I found a possible solution storing the adresses of the touches in a CFDictionary. This seems reasonable in Objective-C, but Swift isn't very pointer-friendly and I haven't managed to create a CFDictionary taking pointers on UITouch as value.
Does anyone know how to handle this ? Am I using CFDictionaries wrong (I tried having UnsafePointer<UITouch> as value) ? Is there another solution that I overlooked ?
Thanks for your help.
Dictionary<UITouch>instead of aCFDictionary? - tkanzakic