Search code examples
swift3gesture

just worked on a pinch gesture recognizer in swift 3 and can not figure out the following error


var width: CGFloat = 0
var height: CGFloat = 0
@IBOutlet weak var imageView1: UIImageView!

@IBAction func zoomto(_ sender: UIPinchGestureRecognizer) {

imageView1.frame = CGRect(imageView1.frame.origin.x, imageView1.frame.origin.y, width * sender.scale, height * sender.scale)
  }

showing an error "Argument labels '( _ :, _ :, _ :, _:)' do not match any available overloads

Any idea what needs to change to resolve this


Solution

  • I think you have to use a valid CGRect constructor - see the docs here.

    In your case it would be something like :

    CGRect(x: imageView1.frame.origin.x, y: imageView1.frame.origin.y, width: width * sender.scale, height: height * sender.scale)