SwiftStudier SwiftStudier - 1 year ago 42
Swift Question

Check if different views touched at the same time

I've few UIView on my ViewController
How can I check if all of them touched now? They are placed in different sides of screen and each of them must be touched by separated fingers

Answer Source

using the touchesEnded delegate

override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
        startTouchPosition = touches.first?.locationInView(self)
        let touch = touches.first
        if let touchPoint = touch?.locationInView(self){
            for view in self.views{