Learning to work with iOS, I found an example of how to perform gesture recognition
This is how it looks in the example.
And just the same, I implemented it in my implementation
import UIKit class FaceViewController: UIViewController { var expression = FacialExpression(eyes: .Open, eyeBrown: .Normal, mouth: .Smile) { didSet { updateUI() } } @IBOutlet weak var faceView: FaceView! { didSet { faceView.addGestureRecognizer(UIPinchGestureRecognizer( target: faceView, action: #selector(FaceView.changeScale(_ :)) )) updateUI() } } class FaceView: UIView { @IBInspectable var scale: CGFloat = 0.9 { didSet { setNeedsDisplay() } } @IBInspectable var mouthCurvature: Double = 1.0 { didSet { setNeedsDisplay() } } @IBInspectable var eyesOpen: Bool = true { didSet { setNeedsDisplay() } } @IBInspectable var eyebrowTilt: Double = 0.5 { didSet { setNeedsDisplay() } } @IBInspectable var color: UIColor = UIColor.blue { didSet { setNeedsDisplay() } } @IBInspectable var lineWidth: CGFloat = 5.0 { didSet { setNeedsDisplay() } } func changeScale(recognizer: UIPinchGestureRecognizer) { switch recognizer.state { case .changed, .ended: scale *= recognizer.scale recognizer.scale = 1.0 default: break } } But I’m Type FaceView has no member changeScale error. Type FaceView has no member changeScale
and as far as I understand it is logical as I try to refer to it as a static method FaceView.changeScale , but this is the method of the object ...
But how then does this work in the example? Maybe the difference in the versions of the swift?
And then, if I make this function static, then it naturally asks for the parameter recognizer: UIPinchGestureRecognizer , but I cannot pass it because it is not initialized ...
In general, it is not clear how this works in the example and does not work for me ...
What did you do wrong?

