today i updated xcode with Swift 1.2 my code was working well on Swift 1.1 but when i updated i got this error:
'Set' does not have a member named 'anyObject'
Here's my code:
override public func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
let location:CGPoint? = touches.anyObject()?.locationInView(self)
if let loc = location {
if (!CGRectContainsPoint(ScaleRect(self.bounds, n: 2.0), loc)) {
self.highlighted = false
}
}
}
Does you guys have an idea on how can i fix that please?
Use first
which is the equivalent of anyObject of NSSet for Swift sets:
touches.first