Just recently Apple released an update to Swift and Xcode.
I am using Swift
I had this line of code before the update:
var touch: AnyObject? = touches.anyObject()
What is the exact equivalent of this line of code in Swift 1.2?
----UPDATE - FOUND SOLUTION----
What was really confusing me, is that al of the places I was looking at had an if statement to find the location.
Like this:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
if let touch = touches.first as? UITouch {
// ...
}
super.touchesBegan(touches , withEvent:event)
}
I found out that I could do this:
var location = CGPoint()
if let touch = touches.first as? UITouch {
location = touch.locationInView(self.view)
}
In which location is now the location of the touch as a CGPoint.