UIPanGestureRecognizer – with it you can move the overview of the area.
For example: you can use UIPinchGestureRecognizer to magnify the picture and now you need the ability to move the viewport to view it completely.

✅ – Create a UIImageView;
✅ – Create UIPanGestureRecognizer ()
✅ – Assign PanGesture function for panning
(panGesture = UIPinchGestureRecognizer (target: self, action: # selector (self.handlePan)));
✅ – We write the necessary actions in the function
(@objc func handlePan (recognizer: UIPanGestureRecognizer) {
let translate = recognizer.translationInView (self.view)
if let view = recognizer.view {
view. center = CGPoint (x: view. center.x + translation. x,
y: view. center.y + translation. y)
} recognizer.setTranslation (CGPointZero, inView: self. view));
✅ – And assign to our picture
(imageView.addGestureRecognizer (panGesture)).

XCODE CODE UIPanGestureRecognizer