直接上代码
// 单击消失
let singleTapGesture = UITapGestureRecognizer(target: self, action: #selector(handleSingleTap(gesture:)))
singleTapGesture.numberOfTapsRequired = 1
addGestureRecognizer(singleTapGesture)
// 双击缩放
let doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap))
doubleTapGesture.numberOfTapsRequired = 2
addGestureRecognizer(doubleTapGesture)
//**关键**
// 只有当没有检测到双击时才执行单击操作
singleTapGesture.require(toFail: doubleTapGesture)