We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var circles = UITouch: CircleWithLabel
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { label.hidden = true for touch in touches { let circle = CircleWithLabel() circle.drawAtPoint(touch.locationInView(view), force: touch.force / touch.maximumPossibleForce) circles[touch] = circle view.layer.addSublayer(circle) } highlightHeaviest() }
override func touchesMoved(touches: Set, withEvent event: UIEvent?) { for touch in touches where circles[touch] != nil { let circle = circles[touch]!
circle.drawAtPoint(touch.locationInView(view), force: touch.force / touch.maximumPossibleForce) } highlightHeaviest() }
func highlightHeaviest() { func getMaxTouch() -> UITouch? { return circles.sort({ (a: (UITouch, CircleWithLabel), b: (UITouch, CircleWithLabel)) -> Bool in
return a.0.force > b.0.force }).first?.0 } circles.forEach { $0.1.isMax = $0.0 == getMaxTouch() } }
override func touchesEnded(touches: Set, withEvent event: UIEvent?) { for touch in touches where circles[touch] != nil { let circle = circles[touch]!
circles.removeValueForKey(touch) circle.removeFromSuperlayer() } highlightHeaviest() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
var circles = UITouch: CircleWithLabel
override func touchesMoved(touches: Set, withEvent event: UIEvent?)
{
for touch in touches where circles[touch] != nil
{
let circle = circles[touch]!
func highlightHeaviest()
{
func getMaxTouch() -> UITouch?
{
return circles.sort({
(a: (UITouch, CircleWithLabel), b: (UITouch, CircleWithLabel)) -> Bool in
override func touchesEnded(touches: Set, withEvent event: UIEvent?)
{
for touch in touches where circles[touch] != nil
{
let circle = circles[touch]!
The text was updated successfully, but these errors were encountered: