Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
tangbl93/whenTapped
whenTapped
whenTapped is a Swift Library that is adding a touch event to UIView.
Inspired by: https://github.com/VincentNarbot/whenTapped
Install
Only support SPM
Use
import whenTapped
Closure
view.whenTapped {
print("view whenTapped")
}
Target-Selecter
view.whenTapped(target: self, selector: #selector(whenTapped))
Strongify
view.whenTapped(self, handler: { (context) in
context.whenTapped()
})
equals to:
view.whenTapped { [weak self] in
guard let strongSelf = self else { return }
strongSelf.whenTapped()
}