Skip to content

Instantly share code, notes, and snippets.

@vialyx
Last active December 7, 2018 18:32
Show Gist options
  • Save vialyx/fd9ad7fb95ce82034f281d34dd18f1ab to your computer and use it in GitHub Desktop.
Save vialyx/fd9ad7fb95ce82034f281d34dd18f1ab to your computer and use it in GitHub Desktop.
import UIKit
class AnimatableTableViewCell: UITableViewCell, HighlightAnimatable {
var settings: HighlightAnimatableSettings {
var settings = HighlightAnimatableSettings()
settings.transform = .init(scaleX: 0.70, y: 0.70)
settings.duration = 0.3
return settings
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
highlight(true)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event)
highlight(false)
}
override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event)
highlight(false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment