Crop image in UIScrollView with Swift

I recently had a project where I had to crop a UIImageView based on it’s scale, after having been resized within a UIScrollView. The solution to this task turned out to be incredibly simple – see the code below.

imageScrollView – reference to our UIScrollView
editingImage – reference to our UIImage used to create our UIImageView which itself is a child of imageScrollView.

Happy coding 🙂


Leave a comment