Skip to content

Commit

Permalink
improve(tap): return gesture recognizer
Browse files Browse the repository at this point in the history
  • Loading branch information
dcvz committed Jan 3, 2024
1 parent ad83d2d commit dcb34ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/DSKit/UIKit/UIView/UIView+TapGestureRecognizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ public extension UIView {
}

// Adds a tap gesture recognizer to the view
@objc func onTapGesture(perform action: @escaping () -> Void) {
@objc @discardableResult func onTapGesture(perform action: @escaping () -> Void) -> UITapGestureRecognizer {
isUserInteractionEnabled = true
tapAction = action

let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture))
addGestureRecognizer(tapGestureRecognizer)

return tapGestureRecognizer
}

// Handles the tap gesture
Expand Down

0 comments on commit dcb34ff

Please sign in to comment.