Created
October 15, 2018 15:13
-
-
Save heestand-xyz/72946d926ea2599e36dd5c576edf7cb8 to your computer and use it in GitHub Desktop.
Touches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var allTouches: [UITouch] = [] | |
func add(_ touches: Set<UITouch>) -> [UITouch] { | |
for newTouch in touches { | |
var exist = false | |
for oldTouch in allTouches { | |
if oldTouch == newTouch { | |
exist = true | |
break | |
} | |
} | |
if !exist { | |
allTouches.append(newTouch) | |
} | |
} | |
return allTouches | |
} | |
func remove(_ touches: Set<UITouch>) -> [UITouch] { | |
for newTouch in touches { | |
for (i, oldTouch) in allTouches.enumerated() { | |
if oldTouch == newTouch { | |
allTouches.remove(at: i) | |
break | |
} | |
} | |
} | |
return allTouches | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment