How to declare UIGestureRecognizer in iOS

Issue #362

1
2
3
4
5
let tapGR = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))

@objc private func handleTap(_ gr: UITapGestureRecognizer) {
didTouch?()
}

We need to use lazy instead of let for gesture to work

1
lazy var tapGR = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))

Comments