ViewExtensions
Add recognizers
let view = UIView()
view.recognize(.tap) { _ in
// handle tap
}
// if you need any additional setup
view.recognize(.pan) { gesture in
let pan = gesture as! UIPanGestureRecognizer
// ...
}
Extend touches zone
view.padding = 10
Same logic for UIButton
let button = UIButton(type: .infoDark)
// you can set padding to increase button response frame
button.padding = 20
button.handle(.touchUpInside) {
// handle tap
}
Installation
ViewExtensions is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ViewExtensions'
Author
vysotskiyserhiy, [email protected]
License
ViewExtensions is available under the MIT license. See the LICENSE file for more info.