
- Imitating the function of Android Button, there will be a visual reaction when you click or long press.
- 仿Android Button的功能,让在点击或长按的时候,会有视觉上的反应。

dependencies: [
.package(url: "https://github.com/William-Weng/WWTouchEffectButton.git", .upToNextMajor(from: "1.0.0"))
]

WWTouchEffectButtonDelegate
函式 |
功能 |
touch(_:event:) |
点击的事件 |
longPress(_:state:) |
长按的状态 |
import UIKit
import WWPrint
import WWTouchEffectButton
final class ViewController: UIViewController {
@IBOutlet weak var myTouchEffectButton: WWTouchEffectButton!
override func viewDidLoad() {
super.viewDidLoad()
myTouchEffectButton.delegate = self
}
}
extension ViewController: WWTouchEffectButtonDelegate {
func touch(_ button: WWTouchEffectButton, event: UIControl.Event) {
wwPrint("event => \(event)")
}
func longPress(_ button: WWTouchEffectButton, state: UIGestureRecognizer.State) {
wwPrint("state => \(state)")
}
}