func swipeForMouth(_ recognizer:UISwipeGestureRecognizer) {
if recognizer.direction == .up{
expression.mouth = expression.mouth.happierMouth()
}
else if recognizer.direction == .down{
expression.mouth = expression.mouth.sadderMouth()
}
}//I wanna use this func to draw a MouthView BUT it won't work
//One Practical way to achieve that:
let happierGesture = UISwipeGestureRecognizer(target: self, action: #selector(FaceViewController.increaseHappiness))
//There is a "increaseHappiness" func to do such stuff like "expression.mouth = expression.mouth.sadderMouth()"
happierGesture.direction = .up
faceView.addGestureRecognizer(happierGesture)
let sadderGesture = UISwipeGestureRecognizer(target: self, action: #selector(self.decreaseHappiness))
sadderGesture.direction = .down
faceView.addGestureRecognizer(sadderGesture)
I may omit some details of the code,but I wonder why the former one just won't work? Obviously the latter one takes more codes to achieve that AND how can I fix the former one using different swiping-gesture directions of UISwipeGestureRecognizer in one func?