This package is used to easily create tap feedback.
Important:
Typically you would create an extension function to UIView like this:
extension UIView {
func applyFeedback(showFeedback: @escaping (Bool) -> (), onTouchUpInside: @escaping () -> ()) {
let feedbackButton = FeedbackButton(showFeedback: showFeedback, onTouchUpInside: onTouchUpInside)
addSubview(feedbackButton)
feedbackButton.constrainTo(self, .allBorders) // Note: This function is defined in the Swift package "Constraint".
}
}
Then you can specify the desired code for any UIView that should react on tap events:
xBackgroundView.applyFeedback(showFeedback: { feedback in
if feedback {
xImageView.tintColor = .systemGray5
} else {
xImageView.tintColor = .systemGray4
}
}, onTouchUpInside: {
textField.text = ""
textField.becomeFirstResponder()
})
The contents of this repository is licensed under the Apache License, version 2.0.
link |
Stars: 0 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics